예제 #1
0
        public ActionResult Save(User oUser)
        {
            bool Add_Flag = new CommonBL().isNewEntry(oUser.UserId);

            try
            {
                oUser.ModifiedBy = oCrntUser.Email;
                oUser.ModifiedOn = DateTime.UtcNow;

                if (Add_Flag)
                {
                    new UserBL().Create(oUser);
                }
                else
                {
                    new UserBL().Update(oUser);
                }

                return(Json(new { success = true, message = CommonMsg.Success(EntityNames.User, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
            catch (Exception)
            {
                return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.User, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
        }
 public JsonResult DeleteEmbroideryFirmLocattion(Guid id)
 {
     try
     {
         if (!new EmbroideryFirmLocationsBL().IsPrimaryLocation(id))
         {
             bool Result = new EmbroideryFirmLocationsBL().Delete(id);
             if (Result == true)
             {
                 return(Json(new { success = true, message = CommonMsg.Success(EntityNames.EmbroideryFirmLocation, En_CRUD.Delete) }));
             }
             else
             {
                 return(Json(new { success = false, message = CommonMsg.DependancyError() }));
             }
         }
         else
         {
             return(Json(new { success = false, message = "you can't delete Primary Location, Please set other Location as Primary Location first." }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.EmbroideryFirmLocation, En_CRUD.Delete) }));
     }
 }
        public ActionResult Save(EmbFirmLocationVM oEmbFirmLocationVM)
        {
            bool Add_Flag = new CommonBL().isNewEntry(oEmbFirmLocationVM.EmbroideryFirmId);

            try
            {
                if (Add_Flag)
                {
                    EmbroideryFirmLocation oEmbroideryFirmLocation = new EmbroideryFirmLocation();
                    oEmbroideryFirmLocation.EmbroideryFirmLocationId = Guid.NewGuid();
                    oEmbroideryFirmLocation.JariCompanyId            = oJariCompany.JariCompanyId;
                    oEmbroideryFirmLocation.ContactPerson            = oEmbFirmLocationVM.ContactPerson;
                    oEmbroideryFirmLocation.Address1          = oEmbFirmLocationVM.Address1;
                    oEmbroideryFirmLocation.Address2          = oEmbFirmLocationVM.Address2;
                    oEmbroideryFirmLocation.City              = oEmbFirmLocationVM.City;
                    oEmbroideryFirmLocation.IsPrimaryLocation = true;
                    oEmbroideryFirmLocation.Status            = true;
                    oEmbroideryFirmLocation.Phone             = oEmbFirmLocationVM.Phone;
                    oEmbroideryFirmLocation.Email             = oEmbFirmLocationVM.Email;
                    oEmbroideryFirmLocation.BillingTerms      = oEmbFirmLocationVM.BillingTerms;
                    oEmbroideryFirmLocation.ModifiedBy        = oUser.Email;
                    oEmbroideryFirmLocation.ModifiedOn        = DateTime.UtcNow;

                    EmbroideryFirm oEmbroideryFirm = new EmbroideryFirm();
                    oEmbroideryFirm.EmbroideryFirmId   = Guid.NewGuid();
                    oEmbroideryFirm.JariCompanyId      = oJariCompany.JariCompanyId;
                    oEmbroideryFirm.IsActive           = oEmbFirmLocationVM.IsActive;
                    oEmbroideryFirm.EmbroideryFirmName = oEmbFirmLocationVM.EmbroideryFirmName;
                    oEmbroideryFirm.ModifiedBy         = oUser.Email;
                    oEmbroideryFirm.ModifiedOn         = DateTime.UtcNow;

                    //Add location with EmbroideryFirm object
                    oEmbroideryFirm.EmbroideryFirmLocations.Add(oEmbroideryFirmLocation);

                    new EmbroideryFirmBL().Create(oEmbroideryFirm);
                }
                else
                {
                    EmbroideryFirm oEmbroideryFirm = new EmbroideryFirm();
                    oEmbroideryFirm.EmbroideryFirmId   = oEmbFirmLocationVM.EmbroideryFirmId;
                    oEmbroideryFirm.JariCompanyId      = oJariCompany.JariCompanyId;
                    oEmbroideryFirm.IsActive           = oEmbFirmLocationVM.IsActive;
                    oEmbroideryFirm.EmbroideryFirmName = oEmbFirmLocationVM.EmbroideryFirmName;
                    oEmbroideryFirm.ModifiedBy         = oUser.Email;
                    oEmbroideryFirm.ModifiedOn         = DateTime.UtcNow;

                    new EmbroideryFirmBL().Update(oEmbroideryFirm);
                }

                TempData["successmsg"] = CommonMsg.Success(EntityNames.EmbroideryFirm, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update);
                //return RedirectToAction("ViewDetail", new { id = oEmbFirmLocationVM.EmbroideryFirmId.ToString().ToUpper(), tab = "EmbroideryFirmDetail" });
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.EmbroideryFirm, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
        }
예제 #4
0
 public JsonResult Delete(int id = 0)
 {
     try
     {
         bool Result = new JariCompanyBL().Delete(id);
         if (Result == true)
         {
             return(Json(new { success = true, message = CommonMsg.Success(EntityNames.Company, En_CRUD.Delete) }));
         }
         else
         {
             return(Json(new { success = false, message = CommonMsg.DependancyError() }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.Company, En_CRUD.Delete) }));
     }
 }
예제 #5
0
 public JsonResult Delete(Guid?id)
 {
     try
     {
         bool Result = new UserBL().Delete((Guid)id);
         if (Result == true)
         {
             return(Json(new { success = true, message = CommonMsg.Success(EntityNames.User, En_CRUD.Delete) }));
         }
         else
         {
             return(Json(new { success = false, message = CommonMsg.DependancyError() }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.User, En_CRUD.Delete) }));
     }
 }
 public JsonResult DeleteEmbroideryFirmPricing(int id)
 {
     try
     {
         bool Result = new EmbroideryFirmPriceSettingsBL().Delete(id);
         if (Result == true)
         {
             return(Json(new { success = true, message = CommonMsg.Success(EntityNames.EmbroideryFirmPricing, En_CRUD.Delete) }));
         }
         else
         {
             return(Json(new { success = false, message = CommonMsg.DependancyError() }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.EmbroideryFirmPricing, En_CRUD.Delete) }));
     }
 }
예제 #7
0
        public ActionResult Save(JariCompany oJariCompany)
        {
            bool Add_Flag = new CommonBL().isNewEntry(oJariCompany.JariCompanyId);

            try
            {
                if (Add_Flag)
                {
                    new JariCompanyBL().Create(oJariCompany);
                }
                else
                {
                    new JariCompanyBL().Update(oJariCompany);
                }

                return(Json(new { success = true, message = CommonMsg.Success(EntityNames.Company, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
            catch (Exception)
            {
                return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.Company, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
        }
예제 #8
0
        public ActionResult SaveShadeCard()
        {
            ShadeCard oShadeCard = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <ShadeCard>(Request["objShadeCard"]);

            bool Add_Flag = new CommonBL().isNewEntry(oShadeCard.ShadeId);

            try
            {
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    using (var binaryReader = new BinaryReader(Request.Files[0].InputStream))
                        oShadeCard.ShadeImage = SiteUtility.ResizeImage(binaryReader.ReadBytes(Request.Files[0].ContentLength), 200, 50);
                }
                else if (oShadeCard.ShadeId != 0)
                {
                    oShadeCard.ShadeImage = new ShadeCardBL().GetById(oShadeCard.ShadeId).ShadeImage;
                }


                oShadeCard.ModifiedBy = oUser.Email;
                oShadeCard.ModifiedOn = DateTime.UtcNow;

                if (Add_Flag)
                {
                    new ShadeCardBL().Create(oShadeCard);
                }
                else
                {
                    new ShadeCardBL().Update(oShadeCard);
                }

                return(Json(new { success = true, message = CommonMsg.Success(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) }));
            }
        }