示例#1
0
        public ActionResult VerifiedTrainers()
        {
            CommonCls commonCls = new CommonCls();

            if (commonCls.getUserIdFromSession() == 0)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                return(View());
            }
        }
        public string SaveImage(string Base64String)
        {
            string fileName = Guid.NewGuid() + ".png";
            Image  image    = CommonCls.Base64ToImage(Base64String);
            var    subPath  = Server.MapPath("~/CustomerPhoto");
            var    path     = Path.Combine(subPath, fileName);

            image.Save(path, System.Drawing.Imaging.ImageFormat.Png);

            string URL = CommonCls.GetURL() + "/CustomerPhoto/" + fileName;

            return(URL);
        }
        public HttpResponseMessage GetAllDivision(int CategoryId, int SubCategoryId)
        {
            try
            {
                var Regions = _DivisionService.GetDivisions().Where(c => c.ParentId == null).OrderBy(c => c.DivisionName);
                List <DivisionModel> RegionModelList = new List <DivisionModel>();
                Mapper.CreateMap <CommunicationApp.Entity.Division, CommunicationApp.Models.DivisionModel>();
                foreach (var Region in Regions)
                {
                    var Suppliers = _SupplierService.GetSuppliers();

                    if (CategoryId != 0)
                    {
                        Suppliers = Suppliers.Where(c => c.CategoryId == CategoryId).ToList();
                    }
                    if (SubCategoryId != 0)
                    {
                        Suppliers = Suppliers.Where(c => c.SubCategoryId == SubCategoryId).ToList();
                    }
                    if (Region.DivisionId != 0)
                    {
                        //Suppliers = Suppliers.Where(c => c.Region.Contains(Region.DivisionId.ToString())).ToList();
                        Suppliers = Suppliers.Where(c => c.Region == Region.DivisionId.ToString()).ToList();
                    }
                    Region.DivisionName = Region.DivisionName + "(" + Suppliers.Count + ")";

                    var SubRegions = _DivisionService.GetDivisions().Where(c => c.ParentId == Region.DivisionId).OrderBy(c => c.DivisionName);
                    List <DivisionModel> SubRegionModelList = new List <DivisionModel>();
                    foreach (var SubRegion in SubRegions)
                    {
                        var SubRegionSuppliers = _SupplierService.GetSuppliers();
                        if (SubRegion.DivisionId != 0)
                        {
                            SubRegionSuppliers = SubRegionSuppliers.Where(c => c.SubRegion == SubRegion.DivisionId.ToString() && c.CategoryId == CategoryId && c.SubCategoryId == SubCategoryId).ToList();
                        }
                        SubRegion.DivisionName = SubRegion.DivisionName + "(" + SubRegionSuppliers.Count + ")";
                        SubRegionModelList.Add(Mapper.Map <CommunicationApp.Entity.Division, CommunicationApp.Models.DivisionModel>(SubRegion));
                    }

                    var _Regionmodel = Mapper.Map <CommunicationApp.Entity.Division, CommunicationApp.Models.DivisionModel>(Region);
                    _Regionmodel.SubRegionModel = SubRegionModelList;
                    RegionModelList.Add(_Regionmodel);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", RegionModelList), Configuration.Formatters.JsonFormatter));
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "No record found."), Configuration.Formatters.JsonFormatter));
            }
        }
        public string SaveImage(string Base64String)
        {
            string fileName = Guid.NewGuid() + ".Jpeg";

            System.Drawing.Image image = CommonCls.Base64ToImage(Base64String);
            var subPath = System.Web.HttpContext.Current.Server.MapPath("~/CustomerPhoto");
            var path    = System.IO.Path.Combine(subPath, fileName);

            image.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);

            string URL = CommonCls.GetURL() + "/CustomerPhoto/" + fileName;

            return(URL);
        }
示例#5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (ddlbank.SelectedValue == "0")
            {
                ShowMessage("Please Select Bank Name.", false);
                ddlbank.Focus();
                return;
            }

            if (ViewState["grdData"] == null)
            {
                ShowMessage("Please Click Add Button For Add Checque Series.", false);
                txtChequefrom.Focus();

                return;
            }

            objChkseries          = new ChequeSeriesModel();
            objChkseries.Ind      = 1;
            objChkseries.OrgID    = GlobalSession.OrgID;
            objChkseries.BrID     = GlobalSession.BrID;
            objChkseries.BankCode = Convert.ToInt32(ddlbank.SelectedValue);
            if (VSItemsData.Columns.Contains("ID"))
            {
                VSItemsData.Columns.Remove("ID");
            }
            objChkseries.DtChkSeries = VSItemsData;

            string    uri           = string.Format("ChequeSeries/SaveChkSerices");
            DataTable dtSaveChkList = CommonCls.ApiPostDataTable(uri, objChkseries);
            if (dtSaveChkList.Rows.Count > 0)
            {
                ShowMessage("Data Save Sucessfully.", true);
                ddlbank.Enabled = true;
                //  pnlSectionGrid.Visible = false;
                ClearAll();
            }
            else
            {
                ShowMessage("Data Not Save Sucessfully.", false);
                return;
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
示例#6
0
        public HttpResponseMessage SaveCredit([FromBody] CreditModel CreditModel)
        {
            try
            {
                if (CreditModel.CustomerId == 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer Id is blank"), Configuration.Formatters.JsonFormatter));
                }
                if (CreditModel.Credits == null || CreditModel.Credits == "")
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Credit is blank"), Configuration.Formatters.JsonFormatter));
                }

                var customer = _CustomerService.GetCustomers().Where(c => c.CustomerId == CreditModel.CustomerId).FirstOrDefault();
                if (customer != null)
                {
                    var credits = _CreditService.GetCredits().Where(c => c.CustomerId == CreditModel.CustomerId).FirstOrDefault();
                    if (credits == null)
                    {
                        Mapper.CreateMap <CreditModel, Credit>();
                        var credit = Mapper.Map <CreditModel, Credit>(CreditModel);
                        _CreditService.InsertCredit(credit);
                        Mapper.CreateMap <Credit, CreditResponseModel>();
                        CreditResponseModel CreditResponseModel = Mapper.Map <Credit, CreditResponseModel>(credit);

                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", CreditResponseModel), Configuration.Formatters.JsonFormatter));
                    }
                    else
                    {
                        credits.Credits = (CreditModel.Credits != null || CreditModel.Credits != "")?CreditModel.Credits:credits.Credits;
                        _CreditService.UpdateCredit(credits);
                        Mapper.CreateMap <Credit, CreditResponseModel>();
                        CreditResponseModel CreditResponseModel = Mapper.Map <Credit, CreditResponseModel>(credits);

                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", CreditResponseModel), Configuration.Formatters.JsonFormatter));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer id is wrong."), Configuration.Formatters.JsonFormatter));
                }
            }
            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();
                ErrorLogging.LogError(ex);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Please try again."), Configuration.Formatters.JsonFormatter));
            }
        }
        public HttpResponseMessage ForgotPassword([FromBody] ForgetPasswordsModel usermodel)
        {
            try
            {
                if (usermodel.CustomerType == "" || usermodel.CustomerType == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer Type is blank."), Configuration.Formatters.JsonFormatter));
                }
                if (usermodel.CustomerType != EnumValue.GetEnumDescription(EnumValue.CustomerType.Customer) && usermodel.CustomerType != EnumValue.GetEnumDescription(EnumValue.CustomerType.ServiceProvider))
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Wrong Customer Type."), Configuration.Formatters.JsonFormatter));
                }
                if (usermodel.EmailId == "" || usermodel.CustomerType == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer Type is blank."), Configuration.Formatters.JsonFormatter));
                }
                var customer = _CustomerService.GetCustomers().Where(x => x.EmailId == usermodel.EmailId && x.CustomerType == usermodel.CustomerType).FirstOrDefault();
                if (customer != null)
                {
                    var user = _UserService.GetUserById(Convert.ToInt32(customer.UserId));
                    if (user != null)
                    {
                        if (!customer.IsActive)
                        {
                            return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User is deactivated."), Configuration.Formatters.JsonFormatter));
                        }
                        //Send Email to User
                        string Password = SecurityFunction.DecryptString(user.Password);
                        SendMailToUser(customer.FirstName + " " + customer.LastName, usermodel.EmailId, Password);

                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", "Password has been sent to your email. Please check your email."), Configuration.Formatters.JsonFormatter));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User is not found."), Configuration.Formatters.JsonFormatter));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Incorrect email id."), Configuration.Formatters.JsonFormatter));
                }
            }
            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();
                ErrorLogging.LogError(ex);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Please try later."), Configuration.Formatters.JsonFormatter));
            }
        }
        public HttpResponseMessage GetProductList([FromUri] int PageNumber)
        {
            try
            {
                //if (ServiceProviderId == 0)
                //{
                //    return Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "ServiceProvider Id is blank"), Configuration.Formatters.JsonFormatter);
                //}

                //var Customer = _CustomerService.GetCustomer(ServiceProviderId);
                //if (Customer != null)
                //{
                //if (Customer.IsActive)
                //{
                var products = _ProductService.GetProducts().ToList();
                if (products.Count() > 0)
                {
                    var list = new List <ProductResponseModel>();
                    foreach (var product in products)
                    {
                        Mapper.CreateMap <Product, ProductResponseModel>();
                        list.Add(Mapper.Map <Product, ProductResponseModel>(product));
                    }
                    int numberOfObjectsPerPage = 10;
                    var modelsdata             = list.Skip(numberOfObjectsPerPage * PageNumber).Take(numberOfObjectsPerPage);
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", modelsdata), Configuration.Formatters.JsonFormatter));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", "no products found."), Configuration.Formatters.JsonFormatter));
                }
                //    }
                //    else
                //    {
                //        return Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User not found."), Configuration.Formatters.JsonFormatter);
                //    }
                //}
                //else
                //{
                //    return Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User not found."), Configuration.Formatters.JsonFormatter);
                //}
            }
            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();
                ErrorLogging.LogError(ex);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Try again later."), Configuration.Formatters.JsonFormatter));
            }
        }
    private bool GetSubSectionID()
    {
        try
        {
            lblMsg.Text = lblMsg.CssClass = "";
            string ReplaceSubSectionName = string.Empty;
            if (lstSubSection.SelectedValue == "")
            {
                SubSectionName = (txtSubSection.Text).ToUpper().Trim();
            }
            else
            {
                SubSectionName = (lstSubSection.SelectedValue).ToUpper().Trim();
            }
            ReplaceSubSectionName = SubSectionName.Replace("%", "_");//replacing string by another character
            //txtSubSection.Text = SubSectionName;
            DataTable dtGRD = VSSubSection;
            if (dtGRD.Rows.Count > 0)
            {
                DataView dv31 = new DataView(dtGRD);
                for (int i = 0; i <= dtGRD.Rows.Count - 1; i++)
                {
                    dtGRD.Rows[i]["SectionName"] = dtGRD.Rows[i]["SectionName"].ToString().Replace("%", "_").Trim();
                }
                DataView ReplaceSubSectionTable = dv31;
                ReplaceSubSectionTable.RowFilter = "SectionName LIKE '" + ReplaceSubSectionName + "%'";
                lblSubSectionNameHindi.Text      = ReplaceSubSectionTable.ToTable().Rows[0]["SectionNameHindi"].ToString();
                SubSectionID       = CommonCls.ConvertIntZero(ReplaceSubSectionTable.ToTable().Rows[0]["SectionId"].ToString());
                txtSubSection.Text = ReplaceSubSectionTable.ToTable().Rows[0]["SectionName"].ToString().Replace("_", "%");
                //txtSubSection.Text = ReplaceBudgetHeadTable.ToTable().Rows[0]["SectionName"].ToString();
            }
            txtBudgetHead.Focus();
            //divListBudgetHead.Style.Add("display", "");
            //divListSection.Style.Add("display", "none");
            //divListSubSection.Style.Add("display", "none");

            divListBudgetHead.Visible = true;
            divListSection.Visible    = false;
            divListSubSection.Visible = false;
            lstSubSection.ClearSelection();
            SubSectionName = "";
            return(true);
        }
        catch (Exception ex)
        {
            ShowMessage("This Sub-Section name is incorrect", false);
            return(false);
        }
    }
示例#10
0
 public HttpResponseMessage DeleteForm(int FormId)
 {
     try
     {
         var form = _formservice.GetForm(FormId);
         _formservice.DeleteForm(form);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", FormId), Configuration.Formatters.JsonFormatter));
     }
     catch (Exception ex)
     {
         string ErrorMsg = ex.Message.ToString();
         ErrorLogging.LogError(ex);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", FormId), Configuration.Formatters.JsonFormatter));
     }
 }
    private void BindAllocatedScheme()
    {
        objNewBudgetAmountModel     = new NewBudgetAmountModel();
        objNewBudgetAmountModel.Ind = 12;
        string    uri      = string.Format("NewBudgetAmount/BindAllocatedScheme");
        DataTable dtScheme = CommonCls.ApiPostDataTable(uri, objNewBudgetAmountModel);

        if (dtScheme.Rows.Count > 0)
        {
            DataView dv31 = new DataView(dtScheme);
            dv31.RowFilter       = "DepartmentName Not = 'Not Allocated' And SubDepartmentName Not = 'Not Allocated'";
            grdScheme.DataSource = dv31.ToTable();
            grdScheme.DataBind();
        }
    }
示例#12
0
 public HttpResponseMessage DeleteRoleDetail(int RoleDetailId)
 {
     try
     {
         var roledetail = _roledetailservice.GetRoleDetail(RoleDetailId);
         _roledetailservice.DeleteRoleDetail(roledetail);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", RoleDetailId), Configuration.Formatters.JsonFormatter));
     }
     catch (Exception ex)
     {
         string ErrorMsg = ex.Message.ToString();
         ErrorLogging.LogError(ex);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", RoleDetailId), Configuration.Formatters.JsonFormatter));
     }
 }
示例#13
0
 public HttpResponseMessage DeleteCity(int CityId)
 {
     try
     {
         var city = _cityservice.GetCity(CityId);
         _cityservice.DeleteCity(city);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", CityId), Configuration.Formatters.JsonFormatter));
     }
     catch (Exception ex)
     {
         string ErrorMsg = ex.Message.ToString();
         ErrorLogging.LogError(ex);
         return(Request.CreateResponse(HttpStatusCode.NotImplemented, CommonCls.CreateMessage("error", CityId), Configuration.Formatters.JsonFormatter));
     }
 }
示例#14
0
 public HttpResponseMessage DeleteUserRole(int UserRoleId)
 {
     try
     {
         var Userrole = _UserRoleservice.GetUserRole(UserRoleId);
         _UserRoleservice.DeleteUserRole(Userrole);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", UserRoleId), Configuration.Formatters.JsonFormatter));
     }
     catch (Exception ex)
     {
         string ErrorMsg = ex.Message.ToString();
         ErrorLogging.LogError(ex);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", UserRoleId), Configuration.Formatters.JsonFormatter));
     }
 }
示例#15
0
        public ActionResult BlockCustomer(Guid id)
        {
            //UserPermissionAction("Account", RoleAction.detail.ToString());
            //CheckPermission();
            if (Session["UserId"] == null)
            {
                return(RedirectToAction("LogOn", "Account"));
            }
            Customer objCustomer = _CustomerService.GetCustomer(id);

            try
            {
                if (objCustomer != null)
                {
                    objCustomer.IsActive = false;
                    _CustomerService.UpdateCustomer(objCustomer);
                    TempData["ShowMessage"] = "success";
                    TempData["MessageBody"] = "Account successfully deactivated.";
                    CommonCls.SendMailOfAccountIsActive(objCustomer.FirstName, objCustomer.EmailId, "deactivated");
                    string UserMessage = "Your account has been deactivated by admin.";
                    string Message     = "{\"flag\":\"" + "Deactivate" + "\",\"UserMessage\":\"" + UserMessage + "\"}";

                    var customerTo = objCustomer;

                    if (customerTo.ApplicationId != null && customerTo.ApplicationId != "")
                    {
                        if (customerTo.DeviceType == EnumValue.GetEnumDescription(EnumValue.DeviceType.Android))
                        {
                            //Send Notification another Andriod
                            CommonCls.SendFCM_Notifications(customerTo.ApplicationId, Message, true);
                        }
                        else
                        {
                            string Msg = UserMessage;

                            CommonCls.TestSendFCM_Notifications(customerTo.ApplicationId, Message, Msg, true);
                        }
                    }
                    return(RedirectToAction("Individuals"));
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.LogError(ex);
                RedirectToAction("Individuals");
            }
            return(RedirectToAction("Individuals"));
        }
 protected void ddlItemName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CommonCls.ConvertIntZero(ddlItemName.SelectedValue) > 0)
     {
         FillItemDetail();
         fillGrid();
     }
     else
     {
         gridOpenStock.DataSource = null;
         gridOpenStock.DataBind();
         //grdOpenStockEntry.DataSource = null;
         //grdOpenStockEntry.DataBind();
     }
     ddlwarehouse.Focus();
 }
示例#17
0
        public ActionResult NewPackageDetails()
        {
            CommonCls commonCls = new CommonCls();

            if (commonCls.getUserIdFromSession() == 0)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                PackageDetailCustom objpkgdetailscustom = new PackageDetailCustom();
                objpkgdetailscustom.lstpackages = _service.PackageRepository.bindPackage();
                objpkgdetailscustom.LstActivity = _service.ActivityRepository.bindActivity();
                return(View(objpkgdetailscustom));
            }
        }
示例#18
0
        public ActionResult RecentChat()
        {
            CommonCls commonCls = new CommonCls();

            if (commonCls.getUserIdFromSession() == 0)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                ChatCustom chatCustom = new ChatCustom();
                chatCustom.LstUsers = _service.TrainerRepository.bindTrainers();
                chatCustom.lstemp   = _service.EmployeeRepository.bindEmployees();
                return(View(chatCustom));
            }
        }
示例#19
0
    private void BindAll()
    {
        try
        {
            objBudgetAmountModel       = new BudgetAmountModel();
            objBudgetAmountModel.Ind   = 1;
            objBudgetAmountModel.OrgID = GlobalSession.OrgID;
            objBudgetAmountModel.BrID  = GlobalSession.BrID;
            string  uri          = string.Format("BudgetAmountTranscation/BindAll");
            DataSet dsSubSection = CommonCls.ApiPostDataSet(uri, objBudgetAmountModel);

            if (dsSubSection.Tables.Count > 0)
            {
                VSSubSection = dsSubSection.Tables[0];
                DataTable dtGRD = dsSubSection.Tables[0];
                if (dtGRD.Rows.Count > 0)
                {
                    DataView dv31 = new DataView(dtGRD);
                    dv31.RowFilter = "ParentSectionID = 0";


                    VSSection = dv31.ToTable();

                    lstSection.DataSource     = VSSection;
                    lstSection.DataTextField  = "SectionName";
                    lstSection.DataValueField = "SectionName";
                    lstSection.DataBind();
                }

                if (dsSubSection.Tables[1].Rows.Count > 0)
                {
                    VSBudgetHead = dsSubSection.Tables[1];


                    lstBudgetHead.DataSource     = dsSubSection.Tables[1];
                    lstBudgetHead.DataTextField  = "AccName";
                    lstBudgetHead.DataValueField = "AccName";
                    lstBudgetHead.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
 public HttpResponseMessage ChangePassword([FromBody] ChangePasswordsModel changeModel)
 {
     try
     {
         var customer = _CustomerService.GetCustomers().Where(x => x.CustomerId == changeModel.CustomerId && x.IsActive == true).FirstOrDefault();
         if (customer != null)
         {
             if (customer.Password == "")
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "only manually registered users can change their password."), Configuration.Formatters.JsonFormatter));
             }
             var user = _UserService.GetUserById(Convert.ToInt32(customer.UserId));//(customer.UserId);
             if (user != null)
             {
                 var sp = _AgencyIndividualService.GetAgencyIndividuals().Where(a => a.UserId == Convert.ToInt32(customer.UserId)).FirstOrDefault();
                 if (SecurityFunction.DecryptString(user.Password) == changeModel.OldPassword)
                 {
                     sp.Password = customer.Password = user.Password = SecurityFunction.EncryptString(changeModel.NewPassword);
                     _UserService.UpdateUser(user);
                     _CustomerService.UpdateCustomer(customer);
                     _AgencyIndividualService.UpdateAgencyIndividual(sp);
                     return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", "Password changed successfully."), Configuration.Formatters.JsonFormatter));
                 }
                 else
                 {
                     return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Wrong old password."), Configuration.Formatters.JsonFormatter));
                 }
             }
             else
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User does not exist."), Configuration.Formatters.JsonFormatter));
             }
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "User does not exist."), Configuration.Formatters.JsonFormatter));
         }
     }
     catch (Exception ex)
     {
         string ErrorMsg = ex.Message.ToString();
         ErrorLogging.LogError(ex);
         return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Please try later."), Configuration.Formatters.JsonFormatter));
     }
 }
示例#21
0
    public static CalculateAll CalculateTotalAmount(DataTable dtItems, DataTable dtSundri)
    {
        CalculateAll cal = new CalculateAll();

        if (dtItems != null)
        {
            DataTable dtGrdItems = (DataTable)(dtItems);

            foreach (DataRow item in dtGrdItems.Rows)
            {
                cal.IGST         += CommonCls.ConvertDecimalZero(item["IGSTTaxAmt"].ToString());
                cal.SGST         += CommonCls.ConvertDecimalZero(item["SGSTTaxAmt"].ToString());
                cal.CGST         += CommonCls.ConvertDecimalZero(item["CGSTTaxAmt"].ToString());
                cal.CESS         += CommonCls.ConvertDecimalZero(item["CESSTaxAmt"].ToString());
                cal.ItemAmount   += CommonCls.ConvertDecimalZero(item["ItemAmount"].ToString());
                cal.ItemTaxable  += CommonCls.ConvertDecimalZero(item["NetAmt"].ToString());
                cal.ItemDiscount += CommonCls.ConvertDecimalZero(item["DiscountAmt"].ToString());
            }
        }

        decimal SundriAmt = 0;

        if (dtSundri != null)
        {
            foreach (DataRow item in dtSundri.Rows)
            {
                if (item["SundriInd"].ToString() == "Add") //For Sundri Amount Add
                {
                    SundriAmt += CommonCls.ConvertDecimalZero(item["SundriAmt"].ToString());
                }
                else if (item["SundriInd"].ToString() == "Less") //For Sundri Amount Less
                {
                    SundriAmt -= CommonCls.ConvertDecimalZero(item["SundriAmt"].ToString());
                }
            }
            cal.TotalSundriAddLess = SundriAmt;
        }
        //cal.TotalGross = cal.ItemTaxable;
        //cal.TotalAllNet = (cal.TotalTaxable + cal.ItemTaxable + cal.TotalSundriAddLess);
        cal.TotalGross   = Math.Round((cal.ItemAmount - cal.ItemDiscount), 2);
        cal.TotalTaxable = Math.Round((cal.IGST + cal.SGST + cal.CGST + cal.CESS), 2);
        cal.TotalAllNet  = Math.Round((cal.TotalGross + cal.TotalTaxable + cal.TotalSundriAddLess), 2);

        return(cal);
    }
        // GET: /Customer/Edit/5
        public ActionResult Edit(int id)
        {
            AdminStaffModel AdminStaffModel = new CommunicationApp.Models.AdminStaffModel();
            var             AdminStaff      = _AdminStaffService.GetAdminStaff(id);

            if (AdminStaff != null)
            {
                var models = new List <AdminModel>();
                Mapper.CreateMap <CommunicationApp.Entity.AdminStaff, CommunicationApp.Models.AdminStaffModel>();
                AdminStaffModel = Mapper.Map <CommunicationApp.Entity.AdminStaff, CommunicationApp.Models.AdminStaffModel>(AdminStaff);
                if (AdminStaffModel.PhotoPath == null && AdminStaffModel.PhotoPath == "")
                {
                    AdminStaffModel.PhotoPath = CommonCls.GetURL() + "/images/noImage.jpg";
                }
            }

            return(View(AdminStaffModel));
        }
        public HttpResponseMessage SavePurchasedLocation([FromBody] LocationModel LocationModel)
        {
            try
            {
                if (LocationModel.CustomerId == 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer Id is blank"), Configuration.Formatters.JsonFormatter));
                }
                if (LocationModel.LocationId == 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Location Id is blank"), Configuration.Formatters.JsonFormatter));
                }

                var customer = _CustomerService.GetCustomers().Where(c => c.CustomerId == LocationModel.CustomerId && c.IsActive == true).FirstOrDefault();
                if (customer != null)
                {
                    var location = _LocationService.GetLocations().Where(l => l.LocationId == LocationModel.LocationId).FirstOrDefault();
                    if (location != null)
                    {
                        location.IsPurchased   = true;
                        location.PurchasedById = LocationModel.CustomerId;
                        _LocationService.UpdateLocation(location);
                        //Mapper.CreateMap<Location, LocationResponseModel>();
                        //LocationResponseModel LocationResponseModel = Mapper.Map<Location, LocationResponseModel>(location);

                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", "Successfully purchased."), Configuration.Formatters.JsonFormatter));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "No location found."), Configuration.Formatters.JsonFormatter));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Customer not found."), Configuration.Formatters.JsonFormatter));
                }
            }
            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();
                ErrorLogging.LogError(ex);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", "Please try again."), Configuration.Formatters.JsonFormatter));
            }
        }
示例#24
0
    protected void ddlMinorUnit_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (CommonCls.ConvertIntZero(ddlItemUnit.SelectedValue) == 0)
        {
            ShowMessage("Select Item Primary Unit First!", false);
            ddlMinorUnit.SelectedValue = "0";
            ddlItemUnit.Focus();
            return;
        }

        if (ddlItemUnit.SelectedValue == ddlMinorUnit.SelectedValue)
        {
            ShowMessage("Item Primary Unit & Secondary Unit Could Not Be Same!", false);
            ddlMinorUnit.Focus();
            return;
        }
        ddlSecUnit.SelectedValue = ddlMinorUnit.SelectedValue;
        ddlMinorUnit.Focus();
    }
        public HttpResponseMessage GetRecentChatListByCustomer([FromUri] Guid CustomerId, [FromUri] int PageNumber)
        {
            var models = new List <RecentChatServiceProviderResponseModel>();

            try
            {
                var jobRequests = _RequestService.GetRequests().Where(c => c.CustomerIdBy == CustomerId).Select(c => c.CustomerIdTo).ToList();
                foreach (var jobRequest in jobRequests.Distinct())
                {
                    var user = _CustomerService.GetCustomer(jobRequest);
                    Mapper.CreateMap <Customer, RecentChatServiceProviderResponseModel>();
                    var customer = Mapper.Map <Customer, RecentChatServiceProviderResponseModel>(user);
                    if (customer != null)
                    {
                        var message = _ChatService.GetChats().Where(c => c.CustomerIdBy == jobRequest || c.CustomerIdTo == jobRequest).OrderByDescending(c => c.DateTimeCreated).Take(1).FirstOrDefault();

                        if (message != null)
                        {
                            string sqlFormattedDate = message.DateTimeCreated.HasValue ? message.DateTimeCreated.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") : "";

                            customer.ChatTime = sqlFormattedDate;
                            customer.Message  = message.ChatContent;
                        }
                        else
                        {
                            customer.Message = "";
                        }

                        //customer.CategoryName = _CategoryService.GetCategory(Convert.ToInt32(_CustomerService.GetCustomer(jobRequest).CategoryId)).Name;
                        models.Add(customer);
                    }
                }
                int numberOfObjectsPerPage = 10;
                var modelsdata             = models.Skip(numberOfObjectsPerPage * PageNumber).OrderByDescending(c => c.ChatTime).Take(numberOfObjectsPerPage);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("success", modelsdata), Configuration.Formatters.JsonFormatter));
            }
            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();
                ErrorLogging.LogError(ex);
                return(Request.CreateResponse(HttpStatusCode.OK, CommonCls.CreateMessage("error", models), Configuration.Formatters.JsonFormatter));
            }
        }
示例#26
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            objBudgetYearActivation     = new BudgetYearActivationModel();
            objBudgetYearActivation.Ind = 1;

            objBudgetYearActivation.YrCode     = 18;
            objBudgetYearActivation.YearFromTo = ddlFinancialYr.SelectedValue;
            objBudgetYearActivation.ActiveID   = 1;
            objBudgetYearActivation.UserID     = GlobalSession.UserID;
            objBudgetYearActivation.IPAddress  = GlobalSession.IP;
            objBudgetYearActivation.AccountInd = 0;
            objBudgetYearActivation.BudgetInd  = 1;

            objBudgetYearActivation.YrStartDate = CommonCls.ConvertToDate("01/04/2018");
            objBudgetYearActivation.YrEndDate   = CommonCls.ConvertToDate("31/03/2019");

            objBudgetYearActivation.BudgetOrderNumber     = txtOrderNo.Text;
            objBudgetYearActivation.BudgetOrderDate       = CommonCls.ConvertToDate(txtOrderDate.Text);
            objBudgetYearActivation.AccountingOrderDate   = "";
            objBudgetYearActivation.AccountingOrderNumber = "";
            objBudgetYearActivation.AccountingEntryDate   = "";
            string    uri    = string.Format("BudgetYearActivation/SaveFinancialYear");
            DataTable dtYear = CommonCls.ApiPostDataTable(uri, objBudgetYearActivation);
            if (dtYear.Rows.Count > 0)
            {
                if (dtYear.Rows[0][0].ToString() == "1")
                {
                    ShowMessage("Financial Year is Activated For Year" + ddlFinancialYr.SelectedValue, true);
                }
            }
            else
            {
                ShowMessage("Data is not saved successfully", false);
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
        public string Savefile(HttpPostedFileBase file)
        {
            //Save the photo in Folder
            var    fileExt  = Path.GetExtension(file.FileName);
            string fileName = Guid.NewGuid() + fileExt;
            var    subPath  = Server.MapPath("~/CustomerPhoto");

            //Check SubPath Exist or Not
            if (!Directory.Exists(subPath))
            {
                Directory.CreateDirectory(subPath);
            }
            //End : Check SubPath Exist or Not

            var path = Path.Combine(subPath, fileName);

            file.SaveAs(path);

            return(CommonCls.GetURL() + "/CustomerPhoto/" + fileName);
        }
示例#28
0
    private void FillGrid()
    {
        objNarrMastermodel = new NarrationMasterModel()
        {
            Ind       = 1,
            OrgID     = GlobalSession.OrgID,
            BrID      = GlobalSession.BrID,
            YrCD      = GlobalSession.YrCD,
            DocTypeID = Convert.ToInt32(ddlFillVoucher.SelectedValue),
        };

        string    uri = string.Format("NarrationMaster/FillGrid");
        DataTable WarehouseFillGridlist = CommonCls.ApiPostDataTable(uri, objNarrMastermodel);

        if (WarehouseFillGridlist.Rows.Count > 0)
        {
            grdNarration.DataSource = WarehouseFillGridlist;
            grdNarration.DataBind();
        }
    }
示例#29
0
    void BindAllBankReceiptDDL()
    {
        try
        {
            plbankrec         = new BankReceiptModel();
            plbankrec.Ind     = 11;
            plbankrec.OrgID   = GlobalSession.OrgID;
            plbankrec.BrID    = GlobalSession.BrID;
            plbankrec.YrCD    = GlobalSession.YrCD;
            plbankrec.VchType = Convert.ToInt32(ViewState["VchType"]);

            string  uri            = string.Format("BankReceipt/BindAllBankReceiptDDL");
            DataSet dsBindAllCRDDL = CommonCls.ApiPostDataSet(uri, plbankrec);
            if (dsBindAllCRDDL.Tables.Count > 0)
            {
                DataTable dtAccountHead = dsBindAllCRDDL.Tables[0];
                DataTable dtLastVoucher = dsBindAllCRDDL.Tables[1];
                DataTable dtNarration   = dsBindAllCRDDL.Tables[2];
                DataTable dtCashAccount = dsBindAllCRDDL.Tables[3];



                // Cash List Bind
                if (dtCashAccount.Rows.Count > 0)
                {
                    ddlbank.DataSource     = dtCashAccount;
                    ddlbank.DataTextField  = "AccName";
                    ddlbank.DataValueField = "AccCode";
                    ddlbank.DataBind();
                    if (dtCashAccount.Rows.Count > 1)
                    {
                        ddlbank.Items.Insert(0, new ListItem("-- Select --", "0"));
                    }
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, false);
        }
    }
        // GET: /Customer/Edit/5
        public ActionResult Edit(int id)
        {
            AdminModel AdminModel = new CommunicationApp.Models.AdminModel();
            var        Customer   = _CustomerService.GetCustomers().Where(c => c.CustomerId == id).FirstOrDefault();

            if (Customer != null)
            {
                var models = new List <AdminModel>();
                Mapper.CreateMap <CommunicationApp.Entity.Customer, CommunicationApp.Models.AdminModel>();
                AdminModel = Mapper.Map <CommunicationApp.Entity.Customer, CommunicationApp.Models.AdminModel>(Customer);
                var User    = _UserService.GetUser(Customer.UserId);
                var Company = _CompanyService.GetCompany(Customer.CompanyID);
                if (Company != null)
                {
                    AdminModel.AdminCompanyLogo    = Company.LogoPath;
                    AdminModel.CompanyName         = Company.CompanyName;
                    AdminModel.AdminCompanyAddress = Company.CompanyAddress;
                }
                if (User != null)
                {
                    AdminModel.Password = SecurityFunction.DecryptString(User.Password);
                }
                if (AdminModel.PhotoPath != null && AdminModel.PhotoPath != "")
                {
                    AdminModel.PhotoPath = AdminModel.PhotoPath;
                }
                else
                {
                    AdminModel.PhotoPath = CommonCls.GetURL() + "/images/noImage.jpg";
                }
            }


            ViewBag.CityID      = (Customer.CityID <= 0 ? "" : Customer.CityID.ToString());
            ViewBag.StateID     = (Customer.StateID <= 0 ? "" : Customer.StateID.ToString());
            ViewBag.Countrylist = new SelectList(_CountryService.GetCountries(), "CountryID", "CountryName", Customer.CountryID);
            ViewBag.Citylist    = new SelectList(_CityService.GetCities(), "CityID", "CityName", Customer.CityID);
            ViewBag.UserId      = new SelectList(_UserService.GetUsers(), "UserId", "FirstName", Customer.UserId);

            return(View(AdminModel));
        }