public ActionResult Add(BranchModel branchModel) { try { fnSetProperties(); CSQLResult oResult = CFBranch.BranchDetailSave(branchModel, ModifiedBy, LoginTypeCode); if (oResult.Success) { ViewBag.IsSuccess = 1; ViewBag.Message = oResult.Exception; } else { ViewBag.IsSuccess = 0; ViewBag.Message = oResult.Exception; } return(View(branchModel)); } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { Message = ex.Message, InnerException = ex.InnerException, StackTrace = ex.StackTrace })); } }
public static CSQLResult OrnamentsDetailRemove(int id) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); DataSet dsOrnamentsInfo = oDBShared.GetDataSet("TOrnamentsInfo", "uspOrnamentsDelete " + id); using (DataTable dtOrnamentsInfo = dsOrnamentsInfo.Tables["TOrnamentsInfo"]) { if (dtOrnamentsInfo != null && dtOrnamentsInfo.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtOrnamentsInfo.Rows[0]["IsSuccess"]); oResult.Exception = dtOrnamentsInfo.Rows[0]["ErrorSuccessMsg"].ToString(); } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CSQLResult OrnamentsDetailSave(OrnamentsModel ornamentsModel, int ModifiedBy, int ModifiedSourceCode) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); DataTable dtImage = new DataTable(); dtImage.Columns.Add("Id", typeof(int)); dtImage.Columns.Add("ImgPath", typeof(string)); ornamentsModel.OrnamentsImgPath.ForEach(element => { dtImage.Rows.Add(new Object[] { Convert.ToInt32(element.IndexOf(element)) + 1, element }); }); string spParameter = ornamentsModel.OrnamentID + "," + ornamentsModel.CategoryID + ", " + ornamentsModel.OrnamentPositionID + ", '" + ornamentsModel.Name + "','" + ornamentsModel.Description + "','" + ornamentsModel.Weight + "'," + ornamentsModel.Cost + "," + dtImage + "," + ModifiedBy + "," + ModifiedBy + "," + ModifiedSourceCode; DataSet dsOrnaments = oDBShared.getSPDataSet("uspOrnamentDetailSave", "@OrnamentID", ornamentsModel.OrnamentID, "@CategoryID", ornamentsModel.CategoryID, "@PositionID", ornamentsModel.OrnamentPositionID, "@Name", ornamentsModel.Name, "@Description", ornamentsModel.Description, "@Weight", ornamentsModel.Weight, "@Cost", ornamentsModel.Cost, "@LogoImgPath", dtImage, "@CreatedBy", ModifiedBy, "@ModifiedBy", ModifiedBy, "@ModifiedSourceCode", ModifiedSourceCode); using (DataTable dtOrnaments = dsOrnaments.Tables["Table"]) { if (dtOrnaments != null && dtOrnaments.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtOrnaments.Rows[0]["IsSuccess"]); oResult.Exception = dtOrnaments.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CSQLResult BranchDetailSave(BranchModel branchModel, int ModifiedBy, int ModifiedSourceCode) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); string ePassword = CShared.GetEncryptString(branchModel.Password); string spParameter = branchModel.BranchID + ", " + branchModel.CompanyID + ",'" + branchModel.Name + "','" + branchModel.Address + "','" + branchModel.Email + "','" + branchModel.Location + "','" + branchModel.Mobile + "','" + branchModel.Username + "','" + ePassword + "'," + ModifiedBy + "," + ModifiedBy + "," + ModifiedSourceCode; DataSet dsBranch = oDBShared.GetDataSet("TBranch", "uspBranchDetailSave " + spParameter); using (DataTable dtBranch = dsBranch.Tables["TBranch"]) { if (dtBranch != null && dtBranch.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtBranch.Rows[0]["IsSuccess"]); oResult.Exception = dtBranch.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CSQLResult CompanyDetailSave(CompanyModel companyModel, int ModifiedBy) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); string ePassword = CShared.GetEncryptString(companyModel.MasterPassword); string spParameter = companyModel.CompanyID + ", '" + companyModel.Name + "','" + companyModel.Address + "','" + companyModel.Email + "','" + companyModel.Mobile + "','" + companyModel.LogoImgPath + "','" + companyModel.MasterUsername + "','" + ePassword + "'," + ModifiedBy + "," + ModifiedBy; DataSet dsCompany = oDBShared.GetDataSet("TCompany", "uspCompanySave " + spParameter); using (DataTable dtCompany = dsCompany.Tables["TCompany"]) { if (dtCompany != null && dtCompany.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtCompany.Rows[0]["IsSuccess"]); oResult.Exception = dtCompany.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CSQLResult OrnamentsPositionDetailSave(OrnamentsPositionModel ornamentsPositionModel, int ModifiedBy, int ModifiedSourceCode) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); string spParameter = ornamentsPositionModel.OrnamentPositionID + "," + ornamentsPositionModel.CategoryID + ", '" + ornamentsPositionModel.Name + "','" + ornamentsPositionModel.Description + "','" + ornamentsPositionModel.ImgPath + "'," + ModifiedBy + "," + ModifiedBy + "," + ModifiedSourceCode; DataSet dsOrnamentsPosition = oDBShared.GetDataSet("TOrnamentsPosition", "uspPositionDetailSave " + spParameter); using (DataTable dtOrnamentsPosition = dsOrnamentsPosition.Tables["TOrnamentsPosition"]) { if (dtOrnamentsPosition != null && dtOrnamentsPosition.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtOrnamentsPosition.Rows[0]["IsSuccess"]); oResult.Exception = dtOrnamentsPosition.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public JsonResult Delete(int id) { try { // USED IN POST METHOD ViewBag.IsSuccess = 0; ViewBag.Message = ""; fnSetProperties(); CSQLResult oResult = CFCompany.CompanyDetailRemove(id); return(Json(oResult, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { CSQLResult oResult = new CSQLResult(); oResult.Exception = ex.Message; oResult.Success = false; oResult.WasSuccessful = 0; oResult.OtherParameter = ex.InnerException.ToString(); return(Json(oResult, JsonRequestBehavior.AllowGet)); } }
public CSQLResult OrnamentsPositionDetailRemove(int id) { CSQLResult oResult = new CSQLResult(); try { DataSet dsOrnamentsPositionInfo = _sqlService.GetDataSet("TOrnamentsPositionInfo", "uspOrnamentPositionDelete " + id); using (DataTable dtOrnamentsPositionInfo = dsOrnamentsPositionInfo.Tables["TOrnamentsPositionInfo"]) { if (dtOrnamentsPositionInfo != null && dtOrnamentsPositionInfo.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtOrnamentsPositionInfo.Rows[0]["IsSuccess"]); oResult.Exception = dtOrnamentsPositionInfo.Rows[0]["ErrorSuccessMsg"].ToString(); } } } catch (Exception ex) { oResult.Success = false; oResult.WasSuccessful = 0; oResult.Exception = ex.Message; } return(oResult); }
public CSQLResult CategoryDetailRemove(int id) { CSQLResult oResult = new CSQLResult(); try { DataSet dsCategory = _sqlService.GetDataSet("TCategory", "uspCategoryDelete " + id); using (DataTable dtCategory = dsCategory.Tables["TCategory"]) { if (dtCategory != null && dtCategory.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtCategory.Rows[0]["IsSuccess"]); oResult.Exception = dtCategory.Rows[0]["ErrorSuccessMsg"].ToString(); } } } catch (Exception ex) { oResult.Success = false; oResult.WasSuccessful = 0; oResult.Exception = ex.Message; } return(oResult); }
public ActionResult Add(CompanyModel companyModel) { try { #region # SAVE COMPANY LOGO IMAGE # string imgDBSavePath = companyModel.LogoImgPath; string sfileName = ""; string sFilePath = ""; if (companyModel.LogoImgFile != null) { if (companyModel.LogoImgFile.ContentLength > 0) { string sFileExt = System.IO.Path.GetExtension(companyModel.LogoImgFile.FileName); sfileName = companyModel.Name + "-" + DateTime.Now.ToString("ddMMyyHHmmss") + sFileExt; sfileName = sfileName.Replace(" ", String.Empty); imgDBSavePath = DirNameCompanyLogoSave + "/" + sfileName; string CombineServerMapPath = ServerMapPath + DirNameCompanyLogoSave; sFilePath = Server.MapPath(CombineServerMapPath); sFilePath = sFilePath.Replace("\\" + PathRemoveString.ToString(), ""); if (!Directory.Exists(sFilePath)) { DirectoryInfo di = Directory.CreateDirectory(sFilePath); } var path = Path.Combine(sFilePath, sfileName); if (!String.IsNullOrEmpty(companyModel.LogoImgPath)) { //SAVE FILE ON DISK companyModel.LogoImgFile.SaveAs(path); var RemoveOldImage = companyModel.LogoImgPath.Replace("/", "\\"); RemoveOldImage = sFilePath + RemoveOldImage.Replace(DirNameCompanyLogoSave, ""); //CHEK FILE IS EXIST ON DISK? if (System.IO.File.Exists(RemoveOldImage)) { //IF YES THEN SLEEP THREAD FOR 5 SEC AND DELETED EXISTING FILE System.IO.File.Delete(RemoveOldImage); } } else { //SAVE FILE ON DISK companyModel.LogoImgFile.SaveAs(path); } // SET ORG LOGO PATH companyModel.LogoImgPath = imgDBSavePath; } } #endregion fnSetProperties(); CSQLResult oResult = CFCompany.CompanyDetailSave(companyModel, ModifiedBy); if (oResult.Success) { ViewBag.IsSuccess = 1; ViewBag.Message = oResult.Exception; } else { ViewBag.IsSuccess = 0; ViewBag.Message = oResult.Exception; } return(View(companyModel)); } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { Message = ex.Message, InnerException = ex.InnerException, StackTrace = ex.StackTrace })); } }
public ActionResult Add(OrnamentsModel ornamentsModel) { try { #region # SAVE ORNAMENT IMAGE # string imgDBSavePath = string.Empty; string sfileName = ""; string sFilePath = ""; if (ornamentsModel.OrnamentsImgFile != null) { foreach (HttpPostedFileBase file in ornamentsModel.OrnamentsImgFile) { if (file.ContentLength > 0) { string sFileExt = System.IO.Path.GetExtension(file.FileName); sfileName = ornamentsModel.Name + "-" + DateTime.Now.Ticks + sFileExt; sfileName = sfileName.Replace(" ", String.Empty); imgDBSavePath = DirNameOrnamentImgSave + "/" + sfileName; string CombineServerMapPath = ServerMapPath + DirNameOrnamentImgSave; sFilePath = Server.MapPath(CombineServerMapPath); sFilePath = sFilePath.Replace("\\" + PathRemoveString.ToString(), ""); if (!Directory.Exists(sFilePath)) { DirectoryInfo di = Directory.CreateDirectory(sFilePath); } var path = Path.Combine(sFilePath, sfileName); //SAVE FILE ON DISK file.SaveAs(path); // SET Image PATH ornamentsModel.OrnamentsImgPath.Add(imgDBSavePath); } } } #endregion fnSetProperties(); CSQLResult oResult = CFOrnaments.OrnamentsDetailSave(ornamentsModel, ModifiedBy, LoginTypeCode); if (oResult.Success) { ViewBag.IsSuccess = 1; ViewBag.Message = oResult.Exception; } else { ViewBag.IsSuccess = 0; ViewBag.Message = oResult.Exception; } return(View(ornamentsModel)); } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { Message = ex.Message, InnerException = ex.InnerException, StackTrace = ex.StackTrace })); } }