public ActionResult InsCity(int StateID, string CityName, int iCityCode) { //submitData oSubmit = new submitData(); clsSubmitModel oSubmit = new clsSubmitModel(); if (iCityCode > 0) { oSubmit.insertData("Update citydet set cityname ='" + CityName + "' where citycode = " + iCityCode, true); } else { DataTable dt; dt = oSubmit.GetData("select isnull(max(citycode),0)+1 citycode from citydet", true); iCityCode = Convert.ToInt32(dt.Rows[0]["citycode"].ToString()); oSubmit.insertData("insert into citydet (citycode , cityname ,citytype, cityrute) values ( " + iCityCode + ",'" + CityName + "',15," + StateID + " )", true); commFunction oCom = new commFunction(); CodeGen oCode = new CodeGen(); oCode.MstCode = iCityCode; oCode.compcode = 0;// SessionMaster.CompCode; oCode.msttype = 15; oCode.mstdate = DateTime.Now.Date; oCode.StDate = Convert.ToDateTime(oCom.getOpenDate(DateTime.Now.Date)); oCode.LastDate = Convert.ToDateTime(oCom.getClosDate(DateTime.Now.Date)); oSubmit.UpdCodeGen_API(oCode); } return(Json(1, JsonRequestBehavior.AllowGet)); }
public ActionResult SendMailQT(string To, string Msg, string Subject) { int sMsg = 0; try { commFunction oComm = new commFunction(); // oComm.Send_Mail("*****@*****.**", "sSubject", "sBody"); // oComm.Email_With_CCandBCC("", "", "", "", ""); const string SERVER2 = "relay-hosting.secureserver.net"; sMsg = 1; System.Web.Mail.MailMessage oMail2 = new System.Web.Mail.MailMessage(); oMail2.From = "*****@*****.**"; oMail2.To = "*****@*****.**"; oMail2.Subject = "Acknowledgement"; oMail2.BodyFormat = System.Web.Mail.MailFormat.Html; // enumeration oMail2.Priority = System.Web.Mail.MailPriority.High; // enumeration sMsg = 2; oMail2.Body = "sBody"; System.Web.Mail.SmtpMail.SmtpServer = SERVER2; System.Web.Mail.SmtpMail.Send(oMail2); oMail2 = null; sMsg = 3; //string from = "*****@*****.**"; //any valid GMail ID //using (MailMessage mail = new MailMessage(from, To)) //{ // mail.Subject =Subject ;// // mail.Body = Msg; // //if (fileUploader != null) // //{ // // string fileName = Path.GetFileName(fileUploader.FileName); // // mail.Attachments.Add(new Attachment(fileUploader.InputStream, fileName)); // //} // mail.IsBodyHtml = false; // SmtpClient smtp = new SmtpClient(); // smtp.Host = "50.62.22.144";// "smtp.digiclayinfotech.com"; // smtp.EnableSsl = true; // NetworkCredential networkCredential = new NetworkCredential(from, "ajay123"); // smtp.UseDefaultCredentials = true; // smtp.Credentials = networkCredential; // smtp.Port = 587; // smtp.Host = "50.62.22.144"; //"localhost"; // smtp.Send(mail); // ViewBag.Message = "Sent"; // // return View("Index", objModelMail); //} return(Json(sMsg, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("E_" + sMsg + "_" + ex.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult SaveSrvCycle(int SrvTypeID, int SrvNo, string SrvCycleDt) { ERPDataContext oTran = new ERPDataContext(); oTran.Connection.Open(); System.Data.Common.DbTransaction transaction = oTran.Connection.BeginTransaction(); string Message = "Successfully Saved ..."; try { string[] Row = SrvCycleDt.Split('^'); tblSrvCycleMst oSrvM; tblSrvCycleItd oSrvI; commFunction oCom = new commFunction(); oSrvM = new tblSrvCycleMst(); oSrvM.SrvNo = SrvNo; oSrvM.SrvTypeID = SrvTypeID; db.tblSrvCycleMsts.InsertOnSubmit(oSrvM); db.SubmitChanges(); foreach (string itm in Row) { if (itm.ToString() != "") { oSrvI = new tblSrvCycleItd(); oSrvI.SrvNo = SrvNo; oSrvI.ItdCode = oSrvM.MstCode; oSrvI.SrvDate = Convert.ToDateTime(itm); db.tblSrvCycleItds.InsertOnSubmit(oSrvI); db.SubmitChanges(); } } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); // transaction.Connection.Close(); Message = ex.Message; } //finally //{ // // transaction.Connection.Close(); //} return(Json(Message, JsonRequestBehavior.AllowGet)); }