|
Not sure if I understood your issue completely. Since you want to let the user edit the texts, you opted for storing them in a database instead of resx files, but still want to use resx files for development, isn't it? I'd suggest to get rid of those resx files here, handle the localization completely in the database (I think software translation shops can handle that, too), thus no need to feed them from the files into the database.
|
|
|
|
|
I have the following code structure:
[CODE]
bool bStop = true;
int RowCount = 65000;
private void btnRun_Click(object sender, EventArgs e)
{
int i = 0;
//int iErr;
while (i < dataGridView1.Rows.Count - 1 && bStop)//Loop 1
{
while (i < dataGridView1.Rows.Count - 1 && bStop)// Loop 2
{
try
{
if (i > 0) dataGridView1.Rows[i-1].Selected = false;
dataGridView1.Rows[i].Selected = true;
dataGridView1["ROWS", i].Value = "Processing...";
System.Windows.Forms.Application.DoEvents();
Thread.Sleep(1000);
Debug.Print("are in Try and i: " + i);
}
catch (Exception ex)
{
Debug.Print("are in Catch and i: " + i + " ex: " + ex.Message);
}
i++;
}
}
}
[/CODE]
|
|
|
|
|
It does - that's the whole point.
You use the try block to catch and handle exceptions, and the code will continue from the line immediately after the catch block.
Since your whole try...catch block is inside your loop, the loop will continue:
int j = 0;
for (int i = 0; i < 5; i++)
{
Console.WriteLine(i);
try
{
i = i / j;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Gives:
0
Attempted to divide by zero.
1
Attempted to divide by zero.
2
Attempted to divide by zero.
3
Attempted to divide by zero.
4
Attempted to divide by zero.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I ran outside with structures on the run very good but when I use add the AT command set and add progress is no way to escape the catch, you know what commands to delete all errors in the catch ?
|
|
|
|
|
I'm sorry, but that didn't make any sense to me - it may be that I haven't had my yet, but I'm working on it - could you try again, this time remembering that I can't see your screen or access your HDD, and only get exactly what you type to work from?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
according to my above code results when run debug: Show output from debug
are in Try and i: 0
are in Try and i: 1
are in Try and i: 2
are in Try and i: 3
are in Try and i: 4
are in Try and i: 5
are in Try and i: 6
are in Try and i: 7
are in Try and i: 8
are in Try and i: 9
are in Try and i: 10
are in Try and i: 11
are in Try and i: 12
are in Try and i: 13
are in Catch and i: 14
are in Catch and i: 15
are in Catch and i: 16
are in Catch and i: 17
are in Catch and i: 18
are in Catch and i: 19
...
|
|
|
|
|
Try running it without a debugger.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Dear
I'm newbie and i'm developing a Windows Service which should make same tasks according some REGISTRY KEY i will populate during Setup Setup (based on VS c# Setup Project).
I need to rollback installation before complete installation if during Setup a web request i run give me back some errors or some special return value.
How can I do using custom action ?
thx
nemo14
|
|
|
|
|
Don't use the registry unless you have no other option: access to it is now restricted, and likely to become more so, not less.
Instead, consider using an XML file (or similar) stored in a more accessible location. Windows provides several: Where should I store my data?[^] and it's a lot easier to just dump a folder on rollback than play with the registry.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Apart from the fact that OriginalGriff is right telling you not to use the registry, your main issue was not solved by his answer: where to do a rollback. Since you talk about a Windows Service, you should have a ServiceInstaller in your project. Then you'll do some overrides, e.g. Rollback , OnBeforeRollback , OnAfterRollback . Which ever you select, do not forget to call base.YourSelectedFunction .
|
|
|
|
|
here i am giving a small my code snippet just to show what i am trying to achieve.
private void frmMain_Load(object sender, EventArgs e)
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
sched = schedFact.GetScheduler();
sched.Start();
IJobDetail job = JobBuilder.Create<frmMain>()
.WithIdentity("Job", "group")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithDailyTimeIntervalSchedule
(s =>
s.WithIntervalInHours(24)
.OnEveryDay()
.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(01, 55))
)
.Build();
sched.ScheduleJob(job, trigger);
}
public void Execute(IJobExecutionContext context)
{
generate();
}
public void generate()
{
if (this.FetchStart != null)
this.FetchStart(this, new EventArgs());
System.Threading.Thread.Sleep(5000);
if (this.FetchDone != null)
this.FetchDone(this, new EventArgs());
}
i have done my project with VS2013 community edition. my objective is to call slide show routine every day at specific time. when i am calling my slide show routine without quartz.net scheduler then it is working fine but when i invoke my routine by quartz.net scheduler then routine is getting called but no slide show image is showing.
what [problem occur is not clear to me. as per my objective i have to use quartz.net scheduler because i need to invoke my routine at a specific time of day every day.
here i am sharing my project code because it is in onedrive. so my request please some one download my project and run at your end to see the problem and tell me the reason which causes not to show images on picture box.
if possible please rectify my code with quartz.net scheduler code. one drive project link is https://1drv.ms/f/s!AmIfMNV-CodPa81zFiNH6Ur7qro
i upload my project folder.
thanks
----------------------------------------------------------------------------------------------------------
UPDATE
when i use background worker along with quartz.net to call my generate routine then also no improvement i found. same problem that slide show image is not appearing on picture box.
here is the code for quartz.net with background worker
public partial class frmMain : Form, IJob
{
ucSlide oSlide = new ucSlide();
IScheduler sched = null;
BackgroundWorker m_oWorker = null;
public event EventHandler FetchStart;
public event EventHandler FetchDone;
public event EventHandler NoDataFound;
public frmMain()
{
InitializeComponent();
m_oWorker = new BackgroundWorker();
m_oWorker.DoWork += new DoWorkEventHandler(m_oWorker_DoWork);
m_oWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(m_oWorker_RunWorkerCompleted);
oSlide.MainForm = this;
oSlide.SlideSource = Utility.SlidePath;
this.Controls.Add(oSlide);
oSlide.Dock = DockStyle.Fill;
}
private void frmMain_Load(object sender, EventArgs e)
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
sched = schedFact.GetScheduler();
sched.Start();
IJobDetail job = JobBuilder.Create<frmMain>()
.WithIdentity("Job", "group")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithDailyTimeIntervalSchedule
(s =>
s.WithIntervalInHours(24)
.OnEveryDay()
.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(02,23))
)
.Build();
sched.ScheduleJob(job, trigger);
}
public void Execute(IJobExecutionContext context)
{
m_oWorker.RunWorkerAsync();
}
public void generate()
{
if (this.FetchStart != null)
this.FetchStart(this, new EventArgs());
System.Threading.Thread.Sleep(5000);
if (this.FetchDone != null)
this.FetchDone(this, new EventArgs());
}
void m_oWorker_DoWork(object sender, DoWorkEventArgs e)
{
generate();
}
void m_oWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
}
}
thanks
tbhattacharjee
|
|
|
|
|
No one is going to download a project to fix it for you. If there is an issue with Quartz.Net, the github for it can be found here[^].
This space for rent
|
|
|
|
|
Functional programming mayhem. Reap now what you sow.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Is there any third party spell checker extension like javascript spell checker to implement in my web api c# project?
I tried javascript spell checker it is working in local perfect. Once publish in online it is showing some message like register and purchase.
Please post is there any free extension because it is urgent for me due client doesn't want to purchase.
|
|
|
|
|
|
Did you even bother to search for free javascript spell checker? It took me seconds to find this[^] and this[^].
This space for rent
|
|
|
|
|
Drag and drop RichTextBox into form in the Form_Load and his running assign content for events RichTextBox_TextChanged RichTextBox but not running although I have to add this line of code:
this.RichTextBox.TextChanged + = new System.EventHandler (this.RichTextBox_TextChanged);
before Form_Load
[CODE]
public Form1()
{
InitializeComponent();
this.RichTextBox.TextChanged + = new System.EventHandler (this.RichTextBox_TextChanged);
this.Load += new System.EventHandler(this.Form1_Load);
}
private void RichTextBox_TextChanged (object sender, System.EventArgs e)
{
do something ...
}
[/ CODE]
as an example of his small examples on running normally, but in the main program will not run, I do not know what is not right ? What advice can you help me fix this.
|
|
|
|
|
You will have to be more specific than "the main program will not run". What do you mean by this? Are you seeing exceptions? If so, which ones are you seeing?
This space for rent
|
|
|
|
|
Hi,
I am trying to print Arabic receipt from Epson TM-T88V from VB.ET and C# application.
I have tried changing font, Epson settings for Arabic and all but it is not printing proper Arabic. It is printing as separation of Arabic alphabets not as a word.
Can someone please help me with this thing?
|
|
|
|
|
As fas as I understand you are using the printer's built-in font which is of poor quality.
Then the only solution to have a better font is to let Windows render a print image and send that to the printer in graphics mode (using the printer driver like with other printers). But this will usually take much more time to print.
|
|
|
|
|
|
Hello to everybody,
I have been struggling now for days on a part of the code i'am working on. And can not find the problem. Explain; If i make a new user on my admin panel everything goes well (It insert in the database), but wenn it comes to the 'verification email' it does not send it to the new user. I can verify manual the database (set 0 to 1), but that is not the way it should be. Strange is that if a user 'forgot' his password yes it is sending the new password with a verification link. I hope someone can help me out. Thanks in advance,
Here is a part off the code;
public ActionResult AddUser()
{
return View();
}
public ActionResult AddUserToDB(string name, string email, string pass, string level, string mode)
{
var lvl = (UserManager.Level)Enum.Parse(typeof(UserManager.Level), level);
var md = (UserManager.Mode)Enum.Parse(typeof(UserManager.Mode), mode);
UserManager.User user = new UserManager.User();
user.Name = name;
user.Email = email;
user.Password = PasswordHash.CreateHash(pass);
user.Level = lvl;
user.Mode = md;
user.ResetCode = "test";
user.ResetCodeUsed = false;
user.CreatedOn = DateTime.Now;
user.SignIP = "";
user.LastIP = "";
user.Status = UserManager.Status.Active;
if (user.Level == UserManager.Level.Agency)
{
user.Level = UserManager.Level.Elite;
user.Mode = UserManager.Mode.Agency;
}
UserManager.AddUser(user);
return RedirectToAction("Users");
}
[HttpPost]
public PartialViewResult UserSorting(string keyword, string icon, int page = 1)
{
ViewData["users"] = UserManager.GetUsers(page, ADMIN_LIMIT, keyword, icon);
int count = UserManager.GetUsersCount();
ViewBag.TotalItems = count;
ViewBag.PageLimit = ADMIN_LIMIT;
ViewBag.CurrentPage = page;
ViewBag.urlExpression = "/admin/users?keyword={0}&icon={1}&page={2}";
ViewBag.Sort = icon;
ViewBag.SortBy = keyword;
return PartialView("~/Views/Partials/_users.cshtml");
}
public ActionResult SignUp()
{
int u = Convert.ToInt32(TempData["user"]);
TempData.Keep();
if (u > 0)
{
return View("SignUp");
}
else
{
return PartialView("login");
}
}
[HttpPost]
public ActionResult SignUp(string name, string email, string password, string confirmpass, string level)
{
List<string> errors = new List<string>();
TempData["Name"] = name;
TempData["Email"] = email;
bool exist = UserManager.IsUserExisting(email.ToLower());
if (exist)
{
ViewBag.Errors = new List<string>() {
"This email exists in our records, please click <a href='/user/signin'>here</a> to login with this credentials."
};
return View();
}
ClickModels.UserManager.User user = new ClickModels.UserManager.User();
user.Name = name;
user.Email = email;
user.Password = PasswordHash.CreateHash(password);
user.Level = (UserManager.Level)Enum.Parse(typeof(UserManager.Level), level);
user.LastIP = Request.UserHostAddress;
user.LastLogin = DateTime.Now;
user.SignIP = Request.UserHostAddress;
user.Status = ClickModels.UserManager.Status.Active;
user.Verified = true;
user.ResetCode = Globals.RandomString(6);
user.CreatedOn = System.DateTime.Now;
user.ID = UserManager.AddUserByAdmin(user);
SendVerificationMail(user);
ViewBag.Done = true;
return View();
}
private void SendVerificationMail(UserManager.User user)
{
Task task = new Task(() =>
{
string eml = System.IO.File.ReadAllText(Server.MapPath("~/app_data/verifymail.txt"));
eml = eml.Replace("[username]", user.Name);
eml = eml.Replace("[appname]", Globals.APPNAME);
eml = eml.Replace("[vericode]", user.ResetCode);
eml = eml.Replace("[appurl]", Globals.APPURL);
eml = eml.Replace("[userid]", user.ID.ToString());
Globals.SendMail(user.Email, "Verify your " + Globals.APPNAME + " membership.", eml);
});
task.Start();
}
[HttpPost]
public ActionResult ChangeStatus(int id, string status)
{
UserManager.UpdateStatus(id, status);
return View();
}
[HttpPost]
public ActionResult ChangeLevel(int userID, string level)
{
UserManager.UpdateLevel(userID, level);
return View();
}
[HttpPost]
public ActionResult UpdateAd(string AdName, string Title, string subtitle, int userid)
{
AdManager.Ad ad = new AdManager.Ad();
ad.ID = userid;
ad.AdName = AdName;
ad.Title = Title;
ad.Subtitle = subtitle;
AdManager.UpdateParticularAd(ad);
return RedirectToAction("Userads", new { userid = userid });
}
}
}
|
|
|
|
|
It is really very hard to understand why,
Globals.SendMail(user.Email, "Verify your " + Globals.APPNAME + " membership.", eml);
fails in your application. But in any case, we are not able to help you out by just reading the code out. We need more information, such as the email address or the service being used.
In case of the email, what is the reason for it not being sent, or any error message? Did you try using the following code? In your own code, what happens is that the code creates a new task in the pool, and then returns a task object for that. However, as soon as the last line gets hit your reference is lost and (maybe, maybe...) your code is unable to proceed to send an email. That is why, I am going to write the code that actually waits for a task to finish.
Task task = Task.Run(() =>
{
string eml = System.IO.File.ReadAllText(Server.MapPath("~/app_data/verifymail.txt"));
eml = eml.Replace("[username]", user.Name);
eml = eml.Replace("[appname]", Globals.APPNAME);
eml = eml.Replace("[vericode]", user.ResetCode);
eml = eml.Replace("[appurl]", Globals.APPURL);
eml = eml.Replace("[userid]", user.ID.ToString());
Globals.SendMail(user.Email, "Verify your " + Globals.APPNAME + " membership.", eml);
});
task.Wait();
Read this as well, Task.Run Method (Action) (System.Threading.Tasks)
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hello Afzaal Ahmad Zeeshan, first of all thank you for take the time&effort! I have implant your code and no error message,
I did not have received any 'error email' it just not send. I will show you a part of my web.config file, I use mailjet.com;
<appSettings>
<add key="admin:mail" value="******@gmail.com" />
<add key="admin:pass" value="*******" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="encryptkey" value="*****" />
<add key="encryptkeysuper" value="******" />
<add key="logpermdura" value="3" />
<add key="logtempdura" value="50" />
<add key="nomailwebsite" value="*****m@gmail.com" />
<add key="emailwebsite" value="*****@gmail.com" />
<add key="appurl" value="http://mar*******.club" />
<add key="app_name" value="GaxHopMSG" />
<add key="mailsmtp" value="in-v3.mailjet.com" />
<add key="maillogin" value="******************************" />
<add key="mailpass" value="******************************" />
<add key="mailport" value="25" />
<add key="permusercookie" value="clkperm" />
<add key="tempusercookie" value="clkmem" />
</appSettings>
Thank you,
|
|
|
|
|
Can you look in the control panel of MailJet services? I think the problem is somewhere on that side. Check if the email request received or not.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|