Ejemplo n.º 1
0
        public void LogException(Exception exception)
        {
            // try-catch because database itself could be down or Request context is unknown.

            try
            {
                int?userId = null;
                try { userId = 0; }
                catch { /* do nothing */ }

                // ** Prototype pattern. the Error object has it default values initialized

                var error = new Error()
                {
                    UserName  = userId.Value.ToString(),
                    Exception = exception.GetType().FullName,
                    Message   = exception.Message,

                    Everything   = exception.ToString(),
                    IpAddress    = HttpContext.Current.Request.UserHostAddress,
                    UserAgent    = HttpContext.Current.Request.UserAgent,
                    PathAndQuery = HttpContext.Current.Request.Url == null ? "" : HttpContext.Current.Request.Url.PathAndQuery,
                    HttpReferer  = HttpContext.Current.Request.UrlReferrer == null ? "" : HttpContext.Current.Request.UrlReferrer.PathAndQuery,
                    CreatedOn    = DateTime.Now,
                    ChangedOn    = DateTime.Now
                };
                using (REMSDBEntities context = new REMSDBEntities())
                {
                    context.Errors.Add(error);
                    context.SaveChanges();
                }
                //DealSiteContext.Errors.Insert(error);
            }
            catch { /* do nothing, or send email to webmaster*/ }
        }
Ejemplo n.º 2
0
        public int AddFlats(int TotalFloor, int FlatOrder, List <int> FlatNo, List <bool> PreIncrement, List <PLCModel> pmodel, string username, int towerID, string FltType, string FltTSize)
        {
            PLCService pservice = new PLCService();
            int        plcCount = pservice.GetPLCCount();

            using (REMSDBEntities context = new REMSDBEntities())
            {
                try
                {
                    for (int i = 1; i <= TotalFloor; i++)
                    {
                        int   kk  = 0;
                        Floor flo = new Floor();
                        flo.CrBy      = username; flo.CrDate = DateTime.Now;
                        flo.TowerID   = towerID;
                        flo.FloorName = i.ToString();
                        flo.FloorNo   = i;
                        context.Floors.Add(flo);
                        context.SaveChanges();
                        int jj = 0;
                        foreach (int flat in FlatNo)
                        {
                            int  fno = GenFlatNo(i, flat, PreIncrement[jj]);
                            Flat fl  = new Flat();
                            fl.FlatOrder    = FlatOrder;
                            fl.FlatNo       = fno.ToString();
                            fl.FlatName     = fno.ToString();
                            fl.FloorID      = flo.FloorID;
                            fl.FlatType     = FltType;
                            fl.FlatSizeUnit = "SqFt";
                            fl.FlatSize     = Convert.ToDecimal(FltTSize);
                            fl.Status       = "Available";
                            context.Flats.Add(fl);
                            context.SaveChanges();

                            for (int k = 0; k <= plcCount - 1; k++)
                            {
                                var pl = pmodel[kk];
                                if (pl.PLCID != 0)
                                {
                                    FlatPLC fpcl = new FlatPLC();
                                    fpcl.CrDate = DateTime.Now;
                                    fpcl.FlatID = fl.FlatID;
                                    fpcl.PLCID  = pl.PLCID;
                                    context.FlatPLCs.Add(fpcl);
                                    context.SaveChanges();
                                }
                                kk++;
                            }
                            jj++;
                        }
                    }
                    return(1);
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }
        }
Ejemplo n.º 3
0
 public string UpdateAssuredChequeAll(string[] chequeNos, string[] chequeDates, string[] aSids, string userName)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         string[] cno   = chequeNos;
         string[] cdate = chequeDates;
         string[] asid  = aSids;
         string   rmsg  = "No";
         for (int i = 0; i < cno.Length; i++)
         {
             if (cno[i] != "" && cdate[i] != "")
             {
                 DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();
                 dtinfo.DateSeparator    = "/";
                 dtinfo.ShortDatePattern = "dd/MM/yyyy";
                 int      id    = Convert.ToInt32(asid[i]);
                 DateTime dt    = Convert.ToDateTime(cdate[i], dtinfo);
                 var      model = context.AssuredReturns.Where(rtn => rtn.AssuredReturnID == id).FirstOrDefault();
                 model.ChequeNo             = cno[i];
                 model.ChequeDate           = dt;
                 model.Status               = "Updated";
                 model.ModifyBy             = userName;
                 model.ModifyDate           = DateTime.Now;
                 context.Entry(model).State = EntityState.Modified;
                 int ii = context.SaveChanges();
                 if (ii >= 1)
                 {
                     rmsg = model.SaleID.Value.ToString();
                 }
             }
         }
         return(rmsg);
     }
 }
Ejemplo n.º 4
0
        public List <AssuredReturnPaymentModel> GetPayment(string saleId)
        {
            REMSDBEntities context = new REMSDBEntities();
            int            id      = Convert.ToInt32(saleId);
            List <AssuredReturnPaymentModel> md = new List <AssuredReturnPaymentModel>();
            var model = context.AssuredReturnPayments.Where(a => a.SaleID == id).AsEnumerable();

            foreach (var v in model)
            {
                Mapper.CreateMap <AssuredReturnPayment, AssuredReturnPaymentModel>();
                var m = Mapper.Map <AssuredReturnPayment, AssuredReturnPaymentModel>(v);
                if (v.PaymentDate != null)
                {
                    m.PaymentDateSt = v.PaymentDate.Value.ToString("dd/MM/yyyy");
                }
                if (v.ChequeDate != null)
                {
                    m.ChequeDateSt = v.ChequeDate.Value.ToString("dd/MM/yyyy");
                }
                if (v.BankClearanceDate != null)
                {
                    m.BankClearanceDateSt = v.BankClearanceDate.Value.ToString("dd/MM/yyyy");
                }
                md.Add(m);
            }
            return(md);
        }
Ejemplo n.º 5
0
 public int AddProject(ProjectModel model)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         try
         {
             if (model.PossessionDateSt != null)
             {
                 model.PossessionDate = Convert.ToDateTime(model.PossessionDateSt, FormData.IndianDateFormat());
             }
             Mapper.CreateMap <ProjectModel, Project>();
             var mdl = Mapper.Map <ProjectModel, Project>(model);
             mdl.RecordStatus = 0;
             mdl.CrDate       = DateTime.Now;
             mdl.ReceiptNo    = "0";
             context.Projects.Add(mdl);
             int i = context.SaveChanges();
             return(i);
         }
         catch (Exception ex)
         {
             Helper hp = new Helper();
             hp.LogException(ex);
             return(0);
         }
     }
 }
 public List <Payment> GetPayment(int saleId)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         return(context.Payments.Where(p => p.SaleID == saleId).ToList());
     }
 }
Ejemplo n.º 7
0
        public Tower TowerList(int towerid)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Towers.Where(tw => tw.TowerID == towerid).FirstOrDefault();

            return(model);
        }
Ejemplo n.º 8
0
 public FlatSaleModel GetFlatSaleBySaleId(string saleId)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         int sid  = Convert.ToInt32(saleId);
         var Sale = context.SaleFlats.Where(c => c.SaleID == sid).FirstOrDefault();
         Mapper.CreateMap <SaleFlat, FlatSaleModel>();
         var model = Mapper.Map <SaleFlat, FlatSaleModel>(Sale);
         if (model != null)
         {
             if (model.SaleDate.Value != null)
             {
                 model.SaleDateSt = model.SaleDate.Value.ToString("dd/MM/yyyy");
             }
         }
         if (model != null)
         {
             if (model.BookingDate != null)
             {
                 model.BookingDateSt = model.BookingDate.Value.ToString("dd/MM/yyyy");
             }
         }
         return(model);
     }
 }
Ejemplo n.º 9
0
 public string UpdateAssuredCheque(string asid, string chequeNo, string chequeDate, string userName)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         if (chequeDate != null && chequeDate != "")
         {
             DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();
             dtinfo.DateSeparator    = "/";
             dtinfo.ShortDatePattern = "dd/MM/yyyy";
             int      id    = Convert.ToInt32(asid);
             DateTime dt    = Convert.ToDateTime(chequeDate, dtinfo);
             var      model = context.AssuredReturns.Where(rtn => rtn.AssuredReturnID == id).FirstOrDefault();
             model.ChequeNo             = chequeNo;
             model.ChequeDate           = dt;
             model.Status               = "Updated";
             model.ModifyBy             = userName;
             model.ModifyDate           = DateTime.Now;
             context.Entry(model).State = EntityState.Modified;
             int i = context.SaveChanges();
             if (i >= 1)
             {
                 return(model.SaleID.Value.ToString());
             }
             else
             {
                 return("No");
             }
         }
     }
     return("No");
 }
 public decimal GetTotalPayment(int saleId)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         return(context.FlatInstallmentDetails.Where(p => p.SaleID == saleId).Sum(p => p.TotalAmount).Value);
     }
 }
Ejemplo n.º 11
0
        public Floor GetFloorByFloorNo(int towerid, int floorid)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            md      = context.Floors.Where(fl => fl.TowerID == towerid && fl.FloorID == floorid).FirstOrDefault();

            return(md);
        }
Ejemplo n.º 12
0
        public Floor FloorList(int floorid)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Floors.Where(tw => tw.FloorID == floorid).FirstOrDefault();

            return(model);
        }
Ejemplo n.º 13
0
        public Project GetProject(int projectID)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Projects.Where(pr => pr.ProjectID == projectID).FirstOrDefault();

            return(model);
        }
Ejemplo n.º 14
0
        public List <Floor> AllFloor()
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Floors.ToList();

            return(model);
        }
Ejemplo n.º 15
0
        public List <Floor> FloorList(string floorname)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Floors.Where(tw => tw.FloorName == floorname).ToList();

            return(model);
        }
        public string GetInstallmetnDetailsByFlatId(int saleId)
        {
            using (REMSDBEntities context = new REMSDBEntities())
            {
                StringBuilder l_StringBuilder    = new StringBuilder();
                var           list               = context.FlatInstallmentDetails.Where(p => p.SaleID == saleId).ToList();
                var           downplayPlanEevnts = "";
                l_StringBuilder.Append("<table class='table table-bordered table-striped particular_tbl'>");
                l_StringBuilder.Append("<thead><tr><th>InstallmentNo</th><th>Due Date</th><th>ModifiedDate</th><th>Due Amount</th></tr></thead><tbody>");
                if (list.Count > 0)
                {
                    decimal dueAmount;
                    string  dueDate     = String.Empty;
                    decimal TotalAmount = 0;
                    for (int i = 0; i < list.Count; i++)
                    {
                        dueAmount          = decimal.Parse(list[i].TotalAmount.ToString());      //-- due amount not found
                        downplayPlanEevnts = Convert.ToString(list[i].InstallmentID.ToString()); //-- InstallmentNo not found
                        if (!String.IsNullOrEmpty(Convert.ToString(list[i].DueDate)))            //-- DueDate not found
                        {
                            l_StringBuilder.Append("<tr><td>" + downplayPlanEevnts.ToString() + "</td></td><td>" + Convert.ToDateTime(list[i].CreateDate).ToString("dd/MM/yyyy") + "</td><td><input type='text' name='txtDueDate' value='" + "" + "' ></td><td>" + dueAmount + "</td></td><tr>");
                        }
                        else
                        {
                            l_StringBuilder.Append("<tr><td>" + downplayPlanEevnts.ToString() + "</td></td><td>" + dueDate + "</td><td>" + dueAmount + "</td><tr>");
                        }

                        TotalAmount = TotalAmount + dueAmount;
                    }
                    l_StringBuilder.Append("<tr><td></td><td></td><td>Total</td><td><b>" + TotalAmount + "</b></td><tr>");
                }
                l_StringBuilder.Append("</tbody>");
                return(l_StringBuilder.ToString());
            }
        }
Ejemplo n.º 17
0
 public List <PaymentModel> GetPaymentBySaleID(string saleId)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         int sid     = Convert.ToInt32(saleId);
         var payment = (from p in context.Payments join c in context.Customers on p.CustomerID equals c.CustomerID where p.SaleID == sid select new { Pay = p, CustomerName = c.AppTitle + " " + c.FName + " " + c.LName + " " + c.MName });
         List <PaymentModel> model1 = new List <PaymentModel>();
         foreach (var v in payment)
         {
             string bdate = "";
             if (v.Pay.PaymentDate != null)
             {
                 bdate = Convert.ToDateTime(v.Pay.PaymentDate).ToString("dd/MM/yyyy");
             }
             string cdate = "";
             if (v.Pay.ChequeDate != null)
             {
                 cdate = Convert.ToDateTime(v.Pay.ChequeDate).ToString("dd/MM/yyyy");
             }
             model1.Add(new PaymentModel {
                 ChequeDateSt = cdate, PaymentDateSt = bdate, Activity = v.Pay.Activity, BankBranch = v.Pay.BankBranch, AmtRcvdinWords = v.Pay.AmtRcvdinWords, BankCharges = v.Pay.BankCharges, BankClearanceDate = v.Pay.BankClearanceDate, BankName = v.Pay.BankName, ChequeDate = v.Pay.ChequeDate, ChequeNo = v.Pay.ChequeNo, ClearanceCharge = v.Pay.ClearanceCharge, PaymentStatus = v.Pay.PaymentStatus, CreatedBy = v.Pay.CreatedBy, InstallmentNo = v.Pay.InstallmentNo, CustomerID = v.Pay.CustomerID, TransactionID = v.Pay.TransactionID, FlatName = v.Pay.FlatName, CustomerName = v.CustomerName, PaymentDate = v.Pay.PaymentDate, PaymentMode = v.Pay.PaymentMode, Remarks = v.Pay.Remarks, SaleID = v.Pay.SaleID, Amount = v.Pay.Amount, PaymentNo = v.Pay.PaymentNo, PaymentID = v.Pay.PaymentID
             });
         }
         return(model1);
     }
 }
        public string GetModuleListByUser(string username)
        {
            REMSDBEntities         context            = new REMSDBEntities();
            DataFunctions          obj                = new DataFunctions();
            List <ModuleListModel> lstPropertyDetails = new List <ModuleListModel>();
            DataTable dt = obj.GetDataTable("select * from ModuleList ");
            string    st = "";

            foreach (DataRow bankDetails in dt.Rows)
            {
                string controller = bankDetails["Controller"].ToString();
                string action = bankDetails["ActionName"].ToString();
                bool   isread = false, iswrite = false; string chk = "";
                var    UAM = context.UserAccesses.Where(ua => ua.UserName == username && ua.ControllerName == controller && ua.ActionName == action).FirstOrDefault();
                if (UAM != null)
                {
                    isread  = UAM.IsRead;
                    iswrite = UAM.IsWrite;
                    if (isread)
                    {
                        chk = "checked";
                    }
                }
                lstPropertyDetails.Add(new ModuleListModel {
                    ModuleListID = Convert.ToInt32(bankDetails["ModuleListID"]), Name = Convert.ToString(bankDetails["Name"]), PageName = bankDetails["PageName"].ToString(), Controller = bankDetails["Controller"].ToString(), ActionName = bankDetails["ActionName"].ToString(), UserName = username, IsRead = isread, IsWrite = iswrite, Checked = chk
                });
                st += @"<tr><td><input type='checkbox' id='" + Convert.ToInt32(bankDetails["ModuleListID"]) + "'  value='" + Convert.ToInt32(bankDetails["ModuleListID"]) + "' name='chkPro' class='Prolist' " + chk + "/></td>";
                st += "<td>" + Convert.ToString(bankDetails["Name"]) + "</td><td>" + Convert.ToString(bankDetails["PageName"]) + "</td><td>" + Convert.ToString(bankDetails["Controller"]) + "</td><td>" + Convert.ToString(bankDetails["ActionName"]) + "</td></tr>";
            }
            return(st);
        }
Ejemplo n.º 19
0
 public int GetPLCCount()
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         var model = context.PLCs.ToList().Count();
         return(model);
     }
 }
Ejemplo n.º 20
0
        public List <Tower> AllTower()
        {
            // List<Tower> tlist = new List<Tower>();
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Towers.ToList();

            return(model);
        }
Ejemplo n.º 21
0
 public int AddTower(Tower tower)
 {
     using (var context = new REMSDBEntities())
     {
         context.Towers.Add(tower);
         int i = context.SaveChanges();
         return(i);
     }
 }
Ejemplo n.º 22
0
 public Flat GetFlatInfoByFlatId(string flatId)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         int fId   = Convert.ToInt32(flatId);
         var model = context.Flats.Where(p => p.FlatID == fId).FirstOrDefault();
         return(model);
     }
 }
Ejemplo n.º 23
0
 public PLCModel GetPLCbyID(int plcID)
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         var model = context.PLCs.Where(pl => pl.PLCID == plcID).FirstOrDefault();
         Mapper.CreateMap <PLC, PLCModel>();
         var plc = Mapper.Map <PLC, PLCModel>(model);
         return(plc);
     }
 }
        public AdditionalChargeModel GetAdditionalChargeByID(int AdditionalChargeID)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.AdditionalCharges.Where(fl => fl.AdditionalChargeID == AdditionalChargeID).FirstOrDefault();

            Mapper.CreateMap <AdditionalCharge, AdditionalChargeModel>();
            var mdl = Mapper.Map <AdditionalCharge, AdditionalChargeModel>(model);

            return(mdl);
        }
Ejemplo n.º 25
0
        public List <Flat> GetFlatList(string flatName, int pId)
        {
            List <Flat>    lstPropertyDetails = new List <Flat>();
            REMSDBEntities context            = new REMSDBEntities();

            return(context.Flats.Where(p => p.FlatName == flatName).ToList()); //&& p.PID == pId).ToList();
            //var Flat = obj.GetDataTable("Select * from tblsflat where FlatName='" + flatname + "' and PID='" + pid + "' and Status=1");
            //var v = Flat.AsEnumerable().ToList();
            //return Json(new { Result = (from i in v select new { FlatID = i["FlatID"], FlatName = i["FlatName"] }) }, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 26
0
        public List <ProjectModel> AllProjects()
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.Projects.ToList();

            Mapper.CreateMap <Project, ProjectModel>().ForMember(dest => dest.PossessionDateSt, opts => opts.MapFrom(src => src.PossessionDate.Value.ToString("dd/MM/yyyy")));
            var mdl = Mapper.Map <List <Project>, List <ProjectModel> >(model);

            return(mdl);
        }
Ejemplo n.º 27
0
 public int EditFloor(Floor floor)
 {
     using (var context = new REMSDBEntities())
     {
         context.Floors.Add(floor);
         context.Entry(floor).State = EntityState.Modified;
         int i = context.SaveChanges();
         return(i);
     }
 }
Ejemplo n.º 28
0
        public List <ProjectTypeModel> AllProjectTypes(int projectID)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.ProjectTypes.Where(pr => pr.ProjectID == projectID).ToList();

            Mapper.CreateMap <ProjectType, ProjectTypeModel>();
            var mdl = Mapper.Map <List <ProjectType>, List <ProjectTypeModel> >(model);

            return(mdl);
        }
Ejemplo n.º 29
0
 public int EditTower(Tower tower)
 {
     using (var context = new REMSDBEntities())
     {
         context.Towers.Add(tower);
         context.Entry(tower).State = EntityState.Modified;
         int i = context.SaveChanges();
         return(i);
     }
 }
        public PlanInstallmentModel GetPlanInstallmentByID(int PlanInstallmentID)
        {
            REMSDBEntities context = new REMSDBEntities();
            var            model   = context.PlanInstallments.Where(fl => fl.PlanInstallmentID == PlanInstallmentID).FirstOrDefault();

            Mapper.CreateMap <PlanInstallment, PlanInstallmentModel>();
            var mdl = Mapper.Map <PlanInstallment, PlanInstallmentModel>(model);

            return(mdl);
        }
Ejemplo n.º 31
0
        public string GetInstallmetnDetailsBySaleId(int saleId, string planType, string saleRate)
        {
            REMSDBEntities context = new REMSDBEntities();
            StringBuilder l_StringBuilder = new StringBuilder();
            var list = context.FlatInstallmentDetails.Where(p => p.SaleID == saleId).ToList();
            decimal bspPercentage = 0;
            if (planType == "1")
            {

                l_StringBuilder.Append("<table class='table table-bordered table-striped particular_tbl'>");
                l_StringBuilder.Append("<thead><tr><th>InstallmentNo</th><th>Due Date</th><th>Due Amount</th></tr></thead><tbody>");
                if (list.Count > 0)
                {
                    decimal dueAmount;
                    string dueDate = String.Empty;
                    decimal TotalAmount = 0;
                    for (int i = 0; i < list.Count; i++)
                    {
                        dueAmount = decimal.Parse(list[i].TotalAmount.ToString());
                        if (!String.IsNullOrEmpty(Convert.ToString(list[i].DueDate)))
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td>" + list[i].DueDate + "</td><td>" + dueAmount + "</td><tr>");
                        }
                        else
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td>" + dueDate + "</td><td>" + dueAmount + "</td><tr>");
                        }
                        TotalAmount = TotalAmount + dueAmount;
                    }
                    l_StringBuilder.Append("<tr><td></td></td><td>Total</td><td><b>" + TotalAmount + "</b></td><tr>");
                }
                l_StringBuilder.Append("</tbody>");
            }
            else if (planType == "2")
            {
                l_StringBuilder.Append("<table class='table table-bordered table-striped particular_tbl'>");
                l_StringBuilder.Append("<thead><tr><th>InstallmentNo</th><th>Due Date</th><th>Due Amount</th></tr></thead><tbody>");
                if (list.Count > 0)
                {
                    decimal dueAmount;
                    decimal TotalAmount = 0;
                    for (int i = 0; i < list.Count; i++)
                    {
                        dueAmount = decimal.Parse(list[i].TotalAmount.ToString());
                        bspPercentage = decimal.Parse(saleRate) * decimal.Parse(list[i].SaleFlat.Flat.FlatSize.ToString());
                        dueAmount += bspPercentage;
                        if (!String.IsNullOrEmpty(Convert.ToString(list[i].DueDate)))
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td>" + list[i].DueDate + "</td><td>" + dueAmount + "</td><tr>");
                        }
                        else
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td></td><td>" + dueAmount + "</td><tr>");
                        }
                        TotalAmount = TotalAmount + dueAmount;
                    }
                    l_StringBuilder.Append("<tr><td></td></td><td> Total</td><td><b>" + TotalAmount + "</b></td><tr>");
                }
                l_StringBuilder.Append("</tbody>");
            }
            else if (planType == "4" || planType == "5")
            {
                //var comboPlan = ComboList();
                l_StringBuilder.Append("<table class='table table-bordered table-striped particular_tbl'>");
                l_StringBuilder.Append("<thead><tr><th>InstallmentNo</th><th>Due Date</th><th>Due Amount</th></tr></thead><tbody>");
                if (list.Count > 0)
                {
                    decimal dueAmount;
                    decimal TotalAmount = 0;
                    //  decimal bspPercentage;
                    for (int i = 0; i < list.Count; i++)
                    {
                        dueAmount = decimal.Parse(list[i].TotalAmount.ToString());
                        if (!String.IsNullOrEmpty(Convert.ToString(list[i].DueDate)))
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td>" + list[i].DueDate.ToString() + "</td><td>" + dueAmount + "</td><tr>");
                        }
                        else
                        {
                            l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td></td><td></td><td>" + dueAmount + "</td><tr>");
                        }
                        TotalAmount = TotalAmount + dueAmount;
                    }
                    l_StringBuilder.Append("<tr><td></td></td><td>Total</td><td><b>" + TotalAmount + "</b></td><tr>");
                }
                l_StringBuilder.Append("</tbody>");
            }
            else
            {
                l_StringBuilder.Append("<table class='table table-bordered table-striped particular_tbl'>");
                l_StringBuilder.Append("<thead><tr><th>INstallmet No</th><th>Due Date</th><th>%</th><th>Amount</th></tr></thead><tbody>");
                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        l_StringBuilder.Append("<tr><td>" + list[i].InstallmentID + "</td><td>" + list[i].DueDate.Value.ToString("dd/MM/yyyy") + "</td><td>" + bspPercentage + "</td><td>" + list[i].TotalAmount + "</td><tr>");
                    }
                }
                l_StringBuilder.Append("</tbody>");
            }
            return Convert.ToString(l_StringBuilder);
        }
Ejemplo n.º 32
0
        public void SaveInstallments(string saledate, string saleprice, string salepriceword, int ddlInstallment, int ddlInterval, string eventName, string bspPercentage, string saleId, string flatId, string evName, string amount, string pplPrice)
        {
            REMSDBEntities context = new REMSDBEntities();
            DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();
            dtinfo.DateSeparator = "/";
            dtinfo.ShortDatePattern = "dd/MM/yyyy";
            DateTime dt2 = DateTime.Now;
            if (saledate != "")
                dt2 = Convert.ToDateTime(saledate, dtinfo);

            var st = context.SaleFlats.Where(s => s.SaleID == Convert.ToInt32(saleId)).FirstOrDefault<SaleFlat>();
            st.SaleRate = Convert.ToDecimal(saleprice);
            st.SaleRateInWords = salepriceword;
            st.SaleDate = dt2;
            st.Status = "1";
            context.SaveChanges();

            StringBuilder l_StringBuilder = new StringBuilder();
            string PlanType = "";
            amount = amount.Replace("undefined,", "");
            amount = amount.TrimEnd(',');
            string[] amounts = amount.Split(',');
            evName = evName.Replace("undefined,", "");
            evName = evName.TrimEnd(',');
            string[] EvNames = evName.Split(',');
            string[] bspPer = bspPercentage.Split(',');
            var fsz = context.Flats.Where(s => s.FlatID == Convert.ToInt32(flatId)).ToList()[0].FlatSize;
            decimal.Parse(saleprice) * decimal.Parse(fsz.ToString());
            if (PlanType == "1")
            {
                DataTable tb = new DataTable();
                if (Session["table"] != null)
                {
                    tb = Session["table"] as DataTable;
                }
                if (tb.Rows.Count > 0)
                {
                    string[] EventIdd = EventName.Split(',');
                    int j = 0;
                    for (int a = 0; a < tb.Rows.Count; a++)
                    {
                        string InstallmentID = Convert.ToString(tb.Rows[a]["InstallmentID"]);
                        string InstallmentNo = Convert.ToString(tb.Rows[a]["InstallmentNo"]);
                        if (a > 0)
                        {
                            InstallmentNo = a.ToString();
                        }
                        string DueAmount = Convert.ToString(tb.Rows[a]["DueAmount"]);
                        string EventID = Convert.ToString(tb.Rows[a]["EventID"]);
                        string TotalAmount = Convert.ToString(tb.Rows[a]["TotalAmount"]);
                        if (DueAmount != "")
                        {
                            Hashtable ht = new Hashtable();
                            ht.Add("DueAmount", DueAmount);
                            ht.Add("DueAmtInWords", clsnew.rupees(Convert.ToInt64(DueAmount)));

                            ht.Add("TotalAmount", saleprice);
                            ht.Add("TotalAmtInWords", clsnew.rupees(Convert.ToInt64(saleprice)));
                            ht.Add("SaleID", Convert.ToInt32(Session["SaleID"].ToString()));
                            ht.Add("InstallmentNo", InstallmentNo);
                            ht.Add("EventName", InstallmentNo);

                            if (!String.IsNullOrEmpty(Convert.ToString(tb.Rows[a]["DueDate"])))
                            {
                                ht.Add("DueDate", obj.Text_IndianDateFormat(Convert.ToString(tb.Rows[a]["DueDate"])));
                            }
                            ht.Add("FlatID", Convert.ToInt32(Session["FlatID"].ToString()));
                            if (Session["TowerID"] != null)
                            {
                                ht.Add("TowerID", Convert.ToInt32(Session["TowerID"].ToString()));
                            }
                            if (InstallmentNo == "Booking Amount" || InstallmentNo == "Possession Amount")
                            {
                                ht.Add("Type", 0);
                            }
                            else
                            {
                                j++;
                                ht.Add("Type", 1);
                            }
                            ht.Add("Activity", "ADD");
                            if (obj.ExecuteProcedure("InsertInstallmentDetail", ht))
                            {
                            }
                        }
                    }
                }
            }
            else if (PlanType == "2")
            {
                DataTable tb = new DataTable();
                #region Construction Based Plan

                if (Session["table"] != null)
                {

                    tb = Session["table"] as DataTable;
                }
                if (tb.Rows.Count > 0)
                {
                    string[] EventIdd = EventName.Split(',');
                    int j = 0;
                    for (int a = 0; a < tb.Rows.Count; a++)
                    {
                        string InstallmentID = Convert.ToString(tb.Rows[a]["InstallmentID"]);
                        string InstallmentNo = Convert.ToString(tb.Rows[a]["InstallmentNo"]);
                        string DueAmount = Convert.ToString(tb.Rows[a]["DueAmount"]);
                        string EventID = Convert.ToString(tb.Rows[a]["EventID"]);
                        string TotalAmount = Convert.ToString(tb.Rows[a]["TotalAmount"]);
                        string DueDate = Convert.ToString(tb.Rows[a]["DueDate"]);
                        if (DueAmount != "")
                        {
                            Hashtable ht = new Hashtable();
                            ht.Add("DueAmount", amounts[a]);
                            ht.Add("DueAmtInWords", clsnew.rupees(Convert.ToDecimal(amounts[a])));

                            ht.Add("TotalAmount", amounts[a]);
                            ht.Add("TotalAmtInWords", clsnew.rupees(Convert.ToDecimal(amounts[a])));
                            ht.Add("SaleID", Convert.ToInt32(Session["SaleID"].ToString()));

                            if (DueDate != "")
                            {
                                ht.Add("DueDate", obj.Text_IndianDateFormat(Convert.ToString(tb.Rows[a]["DueDate"])));           /* Balkrishna  Add one Line By */
                            }

                            ht.Add("FlatID", Convert.ToInt32(Session["FlatID"].ToString()));
                            if (Session["TowerID"] != null)
                            {
                                ht.Add("TowerID", Convert.ToInt32(Session["TowerID"].ToString()));
                            }
                            if (InstallmentNo.Contains("Booking Amount") || InstallmentNo.Contains("Possession Amount"))
                            {
                                ht.Add("Type", 0);
                                ht.Add("InstallmentNo", InstallmentNo);
                                ht.Add("EventName", InstallmentNo);
                            }
                            else
                            {
                                if (!String.IsNullOrWhiteSpace(EventIdd[j]))
                                { ht.Add("EventID", Convert.ToInt32(EventIdd[j])); }
                                ht.Add("EventName", EvNames[j]);
                                ht.Add("InstallmentNo", EvNames[j]);
                                j++;
                                ht.Add("Type", 1);
                            }
                            ht.Add("Activity", "ADD");
                            ht.Add("Bsp", bspPer[a]);
                            if (obj.ExecuteProcedure("[InsertInstallmentDetail]", ht))
                            {
                            }
                        }
                    }
                }
                #endregion
            }
            else if (PlanType == "3")
            {
                #region Normal Mode
                DataTable dt = new DataTable();
                if (Session["table"] != null)
                    dt = (DataTable)Session["table"];
                //string EventName="";
                for (int a = 0; a < dt.Rows.Count; a++)
                {
                    string InstallmentID = Convert.ToString(a + 1);// Convert.ToString(dt.Rows[a]["InstallmentID"]);
                    EventName = Convert.ToString(dt.Rows[a]["Event"]);
                    string EventID = "0";
                    string InstallmentNo = Convert.ToString(dt.Rows[a]["Event"]);// Convert.ToString(dt.Rows[a]["InstallmentNo"]);
                    string DueDate = Convert.ToString(dt.Rows[a]["DueDate"]);
                    string DueAmount = Convert.ToString(dt.Rows[a]["Amount"]);
                    if (DueAmount != "")
                    {
                        Hashtable ht = new Hashtable();
                        if (DueDate != "")
                        {
                            ht.Add("DueDate", Convert.ToDateTime(DueDate, dtinfo));
                        }

                        ht.Add("DueAmount", amounts[a]);
                        ht.Add("DueAmtInWords", clsnew.rupees(Convert.ToInt64(amounts[a])));
                        // ht.Add("ServiceTaxAmount",ServiceTaxAmount.Text);
                        ht.Add("TotalAmount", amounts[a]);
                        ht.Add("TotalAmtInWords", clsnew.rupees(Convert.ToInt64(amounts[a])));
                        ht.Add("SaleID", Convert.ToInt32(Session["SaleID"].ToString()));
                        ht.Add("InstallmentNo", InstallmentNo);
                        ht.Add("FlatID", Convert.ToInt32(Session["FlatID"].ToString()));
                        ht.Add("Type", 0);
                        ht.Add("UserID", Convert.ToInt32("0"));
                        ht.Add("Activity", "Add");
                        ht.Add("EventName", EventName);
                        ht.Add("EventID", EventID);
                        ht.Add("FloorNo", 0);
                        ht.Add("TowerID", 0);
                        ht.Add("BID", 0);
                        ht.Add("BSP", bspPer[a]);
                        if (obj.ExecuteProcedure("InsertInstallmentDetailCLP", ht))
                        {
                        }
                    }
                }
                #endregion
            }
            else if (PlanType == "4" || PlanType == "5")
            {
                DataTable tb = new DataTable();
                #region Combo Plan

                if (Session["table"] != null)
                {
                    tb = Session["table"] as DataTable;
                }
                if (tb.Rows.Count > 0)
                {
                    string[] EventIdd = EventName.Split(',');
                    int j = 0;
                    for (int a = 0; a < tb.Rows.Count; a++)
                    {
                        string InstallmentID = Convert.ToString(tb.Rows[a]["InstallmentID"]);
                        string InstallmentNo = Convert.ToString(tb.Rows[a]["InstallmentNo"]);
                        string DueAmount = Convert.ToString(tb.Rows[a]["DueAmount"]);
                        string EventID = Convert.ToString(tb.Rows[a]["EventID"]);
                        string Eventorder = Convert.ToString(tb.Rows[a]["EventID"]);
                        string DueDate = "";
                        string TotalAmount = Convert.ToString(tb.Rows[a]["TotalAmount"]);
                        if (DueAmount != "")
                        {
                            Hashtable ht = new Hashtable();
                            if (InstallmentNo.Contains("Booking Amount"))
                            {
                                ht.Add("DueDate", obj.Text_IndianDateFormat(saledate));
                            }
                            if (DueDate != "")
                            {
                                ht.Add("DueDate", obj.Text_IndianDateFormat(DueDate));
                            }
                            ht.Add("DueAmount", amounts[a]);
                            ht.Add("DueAmtInWords", clsnew.rupees(Convert.ToDecimal(amounts[a])));
                            ht.Add("TotalAmount", amounts[a]);
                            ht.Add("TotalAmtInWords", clsnew.rupees(Convert.ToDecimal(amounts[a])));
                            ht.Add("SaleID", Convert.ToInt32(Session["SaleID"].ToString()));

                            ht.Add("FlatID", Convert.ToInt32(Session["FlatID"].ToString()));
                            if (Session["TowerID"] != null)
                            {
                                ht.Add("TowerID", Convert.ToInt32(Session["TowerID"].ToString()));
                            }
                            ht.Add("saleprice", saleprice);
                            ht.Add("InstallmentOrder", Eventorder);

                            if (InstallmentNo == "Booking Amount" || InstallmentNo == "Possession Amount")
                            {
                                ht.Add("Type", 0);
                                ht.Add("EventID", 0);
                                ht.Add("EventName", InstallmentNo);
                                ht.Add("InstallmentNo", InstallmentNo);
                            }
                            else
                            {
                                if (!String.IsNullOrWhiteSpace(EventIdd[j]))
                                { ht.Add("EventID", Convert.ToInt32(EventIdd[j])); }
                                ht.Add("EventName", EvNames[j]);
                                ht.Add("InstallmentNo", EvNames[j]);
                                j++;

                                ht.Add("Type", 1);
                            }
                            ht.Add("Activity", "ADD");
                            if (bspPer[a] != null && !String.IsNullOrWhiteSpace(bspPer[a]))
                            {
                                ht.Add("Bsp", bspPer[a]);
                            }
                            if (obj.ExecuteProcedure("InsertInstallmentDetailCombo", ht))
                            {
                            }
                        }
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 33
0
        public List<FlatDetail> GetSaleDetailByFlatId(Int64 flatId)
        {
            REMSDBEntities context = new REMSDBEntities();
            List<FlatDetail> l_FlatDetail = new List<FlatDetail>();
            DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();
            dtinfo.DateSeparator = "/";
            dtinfo.ShortDatePattern = "dd/MM/yyyy";
            var saleFlats = from ft in context.Flats
                            join sale in context.SaleFlats on ft.FlatID equals sale.FlatID
                            join
                                cr in context.Customers on sale.SaleID equals cr.SaleID
                            select new { ft.FlatName, cr.FName, cr.LName, sale.SaleDate };
            var installMentDetail = context.FlatInstallmentDetails.Where(p => p.SaleFlat.FlatID == flatId).ToList();
            l_FlatDetail.Add(new FlatDetail { SaleDate = saleFlats.ToList()[0].SaleDate.ToString(), CustomerName = saleFlats.ToList()[0].FName + " " + saleFlats.ToList()[0].LName, FlatNo = saleFlats.ToList()[0].FlatName });
            if (installMentDetail.Count > 0)
            {
                l_FlatDetail.Add(new FlatDetail { IsPaymentDetails = "Yes" });
                PaymentInstallmentList paymentList = new PaymentInstallmentList();
                for (int i = 0; i < installMentDetail.Count - 1; i++)
                {
                    paymentList.Add(new PaymentInstallment { TotalAmount = installMentDetail[i].TotalAmount.ToString(), DueAmount = installMentDetail[i].TotalAmount.ToString(), DueDate = installMentDetail[i].DueDate.ToString(), InstallmentID = installMentDetail[i].InstallmentID, InstallmentNumber = installMentDetail[i].InstallmentID.ToString() });

                }
                l_FlatDetail.Add(new FlatDetail { paymentInstallmentList = paymentList });
            }

            return l_FlatDetail;
        }
Ejemplo n.º 34
0
 public List<Project> GetProperty()
 {
     using (REMSDBEntities context = new REMSDBEntities())
     {
         int Uid = 1;
         return context.Projects.ToList();
     }
 }