Exemple #1
0
        public static string AddInsuranceCmp(InsuranceCmpList Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.Tbl_InsuranceCmpMaster.Where(x => x.CompanyName == Obj.CompanyName && x.CompanyCode == Obj.CompanyCode && x.DealerId == Obj.DealerId && x.AccountId == Obj.AccountId && x.IsDeleted == false).FirstOrDefault();
                if (ReqData == null)
                {
                    Tbl_InsuranceCmpMaster TIC = new Tbl_InsuranceCmpMaster {
                        CompanyName  = Obj.CompanyName,
                        CompanyCode  = Obj.CompanyCode,
                        IsDeleted    = false,
                        CreatedBy    = Obj.CreatedBy,
                        AccountId    = Obj.AccountId,
                        DealerId     = Obj.DealerId,
                        CreationDate = DateTime.Now
                    };
                    DbContext.Entry(TIC).State = System.Data.Entity.EntityState.Added;
                    DbContext.SaveChanges();

                    return("Added successfully !");
                }
                else
                {
                    return("Already exist !");
                }
            }
        }
Exemple #2
0
        public static string UpdateInsuranceCmp(InsuranceCmpList Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.Tbl_InsuranceCmpMaster.Where(x => x.InsuranceCompanyId == Obj.InsuranceCompanyId).FirstOrDefault();
                if (ReqData != null)
                {
                    ReqData.CompanyName  = Obj.CompanyName;
                    ReqData.CompanyCode  = Obj.CompanyCode;
                    ReqData.IsDeleted    = Obj.IsDeleted;
                    ReqData.ModifiedBy   = Obj.CreatedBy;
                    ReqData.AccountId    = Obj.AccountId;
                    ReqData.DealerId     = Obj.DealerId;
                    ReqData.ModifiedDate = DateTime.Now;

                    DbContext.Entry(ReqData).State = System.Data.Entity.EntityState.Modified;
                    DbContext.SaveChanges();

                    return("Updated successfully !");
                }
                else
                {
                    return("Does not exist !");
                }
            }
        }
        public static bool UpdateContractor(ContractorModel Obj)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.tblContractorMasters.Where(x => x.ContractorCode == Obj.ContractorCode && x.DealerID == Obj.DealerID && x.AccountID == Obj.AccountID).FirstOrDefault();
                if (Check != null)
                {
                    Check.ContractorName = Obj.ContractorName;
                    Check.ContractorCode = Obj.ContractorCode;
                    Check.CreatedBy      = Obj.CreatedBy;
                    Check.AccountID      = Obj.AccountID;
                    Check.IsDeleted      = false;
                    Check.Address        = Obj.Address;
                    Check.Phone          = Obj.Phone;
                    Check.CreationDate   = DateTime.Now;
                    Check.DealerID       = Obj.DealerID;

                    dbContext.Entry(Check).State = System.Data.Entity.EntityState.Modified;
                    dbContext.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
 public static bool AddContractor(ContractorModel Obj)
 {
     using (var dbContext = new BSSDBEntities())
     {
         var Check = dbContext.tblContractorMasters.Where(x => x.ContractorCode == Obj.ContractorCode && x.DealerID == Obj.DealerID && x.AccountID == Obj.AccountID).FirstOrDefault();
         if (Check == null)
         {
             tblContractorMaster Cm = new tblContractorMaster()
             {
                 ContractorName = Obj.ContractorName,
                 ContractorCode = Obj.ContractorCode,
                 CreatedBy      = Obj.CreatedBy,
                 AccountID      = Obj.AccountID,
                 IsDeleted      = false,
                 Address        = Obj.Address,
                 Phone          = Obj.Phone,
                 CreationDate   = DateTime.Now,
                 DealerID       = Obj.DealerID
             };
             dbContext.Entry(Cm).State = System.Data.Entity.EntityState.Added;
             dbContext.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Exemple #5
0
        public static string AddEmail(EmailListModel Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.TblEmailMasters.Where(x => x.PersonName == Obj.PersonName && x.AccountId == Obj.AccountId && x.DealerId == Obj.DealerId).FirstOrDefault();
                if (ReqData == null)
                {
                    TblEmailMaster TM = new TblEmailMaster
                    {
                        IsDeleted    = false,
                        PersonName   = Obj.PersonName,
                        Email_ID     = Obj.Email_ID,
                        AccountId    = Obj.AccountId,
                        DealerId     = Obj.DealerId,
                        CreationDate = DateTime.Now,
                        CreatedBy    = Obj.CreatedBy
                    };
                    DbContext.Entry(TM).State = System.Data.Entity.EntityState.Added;
                    DbContext.SaveChanges();

                    return("Updated Successfully");
                }
                else
                {
                    return("Already Exixts!");
                }
            }
        }
        public static void InsertIntoTblDtl(string JobCardNo, SessionDataBLL obj)
        {
            using (var context = new BSSDBEntities())
            {
                var JobCardId = context.TblJobCardHdrs.Where(x => x.JobCardNo == JobCardNo && x.DealerID == obj.DealerID).Select(x => x.JobCardId).FirstOrDefault();

                var Check = context.TblJobCardDtls.Where(x => x.JobCardId == JobCardId).FirstOrDefault();

                if (Check == null)
                {
                    TblJobCardDtl tb = new TblJobCardDtl
                    {
                        JobCardId    = JobCardId,
                        StatusID     = 17,
                        IsDeleted    = false,
                        CreatedBy    = obj.UserId,
                        CreationDate = DateTime.Now,
                        //ModifiedBy=obj.UserId,
                        //ModifiedDate=DateTime.Now
                    };

                    context.Entry(tb).State = EntityState.Added;
                    context.SaveChanges();
                }
            }
        }
        public static string UpdateStatus(UpdateStatusBLL obj, string PhotoUrl)
        {
            long JobCardId = Convert.ToInt64(obj.JobCardId);

            using (var dbContext = new BSSDBEntities())
            {
                var UpdateData    = dbContext.TblJobCardDtls.Where(x => x.JobCardId == JobCardId).FirstOrDefault();
                var UpdateHdrData = dbContext.TblJobCardHdrs.Where(x => x.JobCardId == JobCardId).FirstOrDefault();
                if (UpdateData != null)
                {
                    TblJobCardDtl bp = new TblJobCardDtl
                    {
                        JobCardId     = obj.JobCardId,
                        No_Of_Panel   = obj.NumberOfPanel,
                        PanelReplaced = obj.PanelReplaced,
                        StatusID      = obj.StatusID,
                        ContractorId  = obj.Contractor_Id,
                        NoOfGlass     = obj.Glass,
                        CreatedBy     = UpdateData.CreatedBy,
                        CreationDate  = UpdateData.CreationDate,
                        ModifiedBy    = obj.ModifiedBy,
                        ModifiedDate  = DateTime.Now
                    };
                    dbContext.Entry(bp).State = EntityState.Added;
                    dbContext.SaveChanges();

                    UpdateHdrData.InsuranceCompanyId = obj.InsCompId;
                    UpdateHdrData.PaymentMode        = obj.PaymentMode;

                    dbContext.Entry(UpdateHdrData).State = EntityState.Modified;
                    dbContext.SaveChanges();
                    //Updating photo details
                    UpdateStatusDAL.UpdatePhotoDtl(obj.JobCardId, PhotoUrl);

                    return("success");
                }
                else
                {
                    return("Error");
                }
            }
        }
Exemple #8
0
        public static void AddQuery(AddQueryBLL obj)
        {
            string JobCardNo = obj.JobCardNo;

            using (var dbcontext = new BSSDBEntities())
            {
                var Check = dbcontext.TblJobCardHdrs.Where(x => x.JobCardNo == JobCardNo).FirstOrDefault();
                if (Check == null)
                {
                    TblJobCardHdr TR = new TblJobCardHdr
                    {
                        JobCardNo        = obj.JobCardNo,
                        DateAndTime      = DateTime.Now,
                        CustomerName     = obj.CustomerName,
                        PhoneNo          = obj.PhoneNo,
                        CustomerCategory = obj.CustomerCategory,
                        PSFStatus        = obj.PSFStatus,
                        RegistrationNo   = obj.RegistrationNo,
                        Model            = obj.Model,
                        SA           = obj.SA,
                        Technician   = obj.Technician,
                        Service      = obj.Service,
                        PromisedDate = obj.PromisedDate
                    };

                    dbcontext.Entry(TR).State = EntityState.Added;
                    dbcontext.SaveChanges();

                    var JobCardId = dbcontext.TblJobCardHdrs.Where(x => x.JobCardNo == JobCardNo).Select(s => s.JobCardId).FirstOrDefault();

                    TblJobCardDtl tb = new TblJobCardDtl
                    {
                        JobCardId     = JobCardId,
                        No_Of_Panel   = obj.NoOfPanel,
                        PanelReplaced = obj.PanelReplaced,
                        //Status=obj.Status
                    };
                    dbcontext.Entry(tb).State = EntityState.Added;
                    dbcontext.SaveChanges();
                }
            }
        }
        public static void Delete(long StatusID)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.TblStatus.Where(x => x.StatusID == StatusID).FirstOrDefault();

                if (Check != null)
                {
                    Check.IsDeleted = true;
                    dbContext.Entry(Check).State = System.Data.Entity.EntityState.Modified;
                    dbContext.SaveChanges();
                }
            }
        }
Exemple #10
0
        public static void Update(string BrandName, long BrandId)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.tblBrands.Where(x => x.BrandId == BrandId).FirstOrDefault();

                if (Check != null)
                {
                    Check.BrandName = BrandName;
                    dbContext.Entry(Check).State = System.Data.Entity.EntityState.Modified;
                    dbContext.SaveChanges();
                }
            }
        }
Exemple #11
0
        public static string UpDate(EmailListModel Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.TblEmailMasters.Where(x => x.Id == Obj.Id).FirstOrDefault();
                ReqData.IsDeleted              = Obj.IsDeleted;
                ReqData.PersonName             = Obj.PersonName;
                ReqData.Email_ID               = Obj.Email_ID;
                ReqData.ModifiedDate           = DateTime.Now;
                ReqData.ModifiedBy             = Obj.ModifiedBy;
                DbContext.Entry(ReqData).State = System.Data.Entity.EntityState.Modified;
                DbContext.SaveChanges();

                return("Updated Successfully");
            }
        }
        public static void Update(StatusWiseBLL obj)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.TblStatus.Where(x => x.StatusID == obj.StatusID && x.AccountId == obj.AccountId && x.DealerId == obj.DealerID).FirstOrDefault();

                if (Check != null)
                {
                    Check.StatusName             = obj.StatusName;
                    Check.ShortName              = obj.ShortName;
                    Check.StatusCode             = obj.StatusCode;
                    Check.ModifiedDate           = DateTime.Now;
                    dbContext.Entry(Check).State = System.Data.Entity.EntityState.Modified;
                    dbContext.SaveChanges();
                }
            }
        }
Exemple #13
0
        public static void Post(string BrandName, long UserId)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.tblBrands.Where(x => x.BrandName == BrandName).FirstOrDefault();

                if (Check == null)
                {
                    tblBrand tb = new tblBrand
                    {
                        BrandName    = BrandName,
                        IsDeleted    = false,
                        CreatedBy    = UserId,
                        CreationDate = DateTime.Now
                    };
                    dbContext.Entry(tb).State = System.Data.Entity.EntityState.Added;
                    dbContext.SaveChanges();
                }
            }
        }
        public static bool Delete(ContractorModel Obj)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.tblContractorMasters.Where(x => x.Contractor_Id == Obj.Contractor_Id).FirstOrDefault();
                if (Check != null)
                {
                    Check.IsDeleted    = true;
                    Check.ModifiedBy   = Obj.ModifiedBy;
                    Check.ModifiedDate = DateTime.Now;

                    dbContext.Entry(Check).State = System.Data.Entity.EntityState.Modified;
                    dbContext.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public static void InsertIntoTblContractor(DataTable info, SessionDataBLL obj)
        {
            using (var context = new BSSDBEntities())
            {
                foreach (DataRow Dr in info.Rows)
                {
                    string ContractorName = Dr["ContractorName"].ToString().Trim();
                    string ContractorCode = Convert.ToString(Dr["ContractorCode"]);
                    if (ContractorCode != null && ContractorCode != string.Empty && ContractorName != null && ContractorName != string.Empty)
                    {
                        string ContractorAddress = Convert.ToString(Dr["ContractorAddress"]);
                        string PhoneNo           = Convert.ToString(Dr["PhoneNo"]);

                        var Check = context.tblContractorMasters.Where(x => x.ContractorCode == ContractorCode && x.DealerID == obj.DealerID).FirstOrDefault();

                        if (Check == null)
                        {
                            tblContractorMaster dt = new tblContractorMaster
                            {
                                ContractorCode = ContractorCode,
                                ContractorName = ContractorName,
                                IsDeleted      = false,
                                Address        = ContractorAddress,
                                AccountID      = obj.AccountId,
                                DealerID       = obj.DealerID,
                                Phone          = PhoneNo,
                                CreatedBy      = Convert.ToString(obj.UserId),
                                CreationDate   = DateTime.Now
                            };
                            context.Entry(dt).State = EntityState.Added;
                            context.SaveChanges();
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
        }
        public static void Post(StatusWiseBLL Obj)
        {
            using (var dbContext = new BSSDBEntities())
            {
                var Check = dbContext.TblStatus.Where(x => x.StatusName == Obj.StatusName && x.DealerId == Obj.DealerID && x.AccountId == Obj.AccountId).FirstOrDefault();

                if (Check == null)
                {
                    TblStatu tb = new TblStatu
                    {
                        StatusName   = Obj.StatusName,
                        ShortName    = Obj.ShortName,
                        StatusCode   = Obj.StatusCode,
                        DealerId     = Obj.DealerID,
                        AccountId    = Obj.AccountId,
                        IsDeleted    = false,
                        CreationDate = DateTime.Now
                    };
                    dbContext.Entry(tb).State = System.Data.Entity.EntityState.Added;
                    dbContext.SaveChanges();
                }
            }
        }
        public static string UpdatePhotoDtl(long JobCardId, string Path)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var Check = DbContext.TblPhotoDtls.Where(x => x.JobCardId == JobCardId && x.PhotoUrl == Path && x.IsDeleted == false).FirstOrDefault();
                if (Check == null)
                {
                    TblPhotoDtl TPD = new TblPhotoDtl
                    {
                        JobCardId = JobCardId,
                        PhotoUrl  = Path,
                        IsDeleted = false,
                    };
                    DbContext.Entry(TPD).State = EntityState.Added;
                    DbContext.SaveChanges();

                    return("Updated");
                }
                else
                {
                    return("Already Exists");
                }
            }
        }
        public static void InsertData(DataTable info, SessionDataBLL obj)
        {
            using (var context = new BSSDBEntities())
            {
                var dt1 = context.TblJobCardHdrs.ToList();

                foreach (DataRow Dr in info.Rows)
                {
                    string JobCardNo = Dr["Job Card No."].ToString().Trim();
                    if (JobCardNo != null && JobCardNo != string.Empty)
                    {
                        //LogService("JobCardNo: " + JobCardNo);
                        //LogService("************************: " + DateTime.Now.ToString());

                        string DateAndTime1 = Convert.ToString(Dr["Date & Time"]);
                        //LogService("DateAndTime1: " + DateAndTime1);
                        //LogService("************************: " + DateTime.Now.ToString());

                        DateTime DateAndTime = Convert.ToDateTime(DateAndTime1);
                        //LogService("DateAndTime: " + DateAndTime);
                        //LogService("************************: " + DateTime.Now.ToString());

                        //DateTime DateAndTime = Convert.ToDateTime(Dr["Date & Time"]);
                        string CustomerName     = Convert.ToString(Dr["Customer Name"]);
                        long   PhoneNo          = Convert.ToInt64(Dr["Phone & Mobile No."]);
                        string CustomerCategory = Convert.ToString(Dr["Customer Catg."]);
                        string PSFStatus        = Convert.ToString(Dr["PSF Status"]);
                        string RegistrationNo   = Convert.ToString(Dr["Registration"]);
                        string Model            = Convert.ToString(Dr["Model"]);
                        string SA           = Convert.ToString(Dr["S.A"]);
                        string Technician   = Convert.ToString(Dr["Technician"]);
                        string Service      = Convert.ToString(Dr["Service"]);
                        string PromisedDate = Convert.ToString(Dr["Promised Dt."]);
                        //LogService("PromisedDate: " + PromisedDate);
                        //LogService("************************: " + DateTime.Now.ToString());

                        string RevPromisedDate = Convert.ToString(Dr["Rev. Promised Dt."]);// Dr["Rev. Promised Dt."].ToString();
                        //LogService("RevPromisedDate: " + RevPromisedDate);
                        //LogService("************************: " + DateTime.Now.ToString());

                        //DateTime RevDATE = Convert.ToDateTime(Dr["Rev. Promised Dt."]);
                        string ReadyDateTime = Convert.ToString(Dr["Ready Date & Time"]);
                        //LogService("ReadyDateTime: " + ReadyDateTime);
                        //LogService("************************: " + DateTime.Now.ToString());

                        var Check = context.TblJobCardHdrs.Where(x => x.JobCardNo == JobCardNo && x.DealerID == obj.DealerID).FirstOrDefault();

                        if (Check == null)
                        {
                            TblJobCardHdr dt = new TblJobCardHdr
                            {
                                JobCardNo        = JobCardNo,
                                DateAndTime      = DateAndTime,
                                CustomerName     = CustomerName,
                                PhoneNo          = PhoneNo,
                                CustomerCategory = CustomerCategory,
                                PSFStatus        = PSFStatus,
                                RegistrationNo   = RegistrationNo,
                                Model            = Model,
                                SA              = SA,
                                Technician      = Technician,
                                Service         = Service,
                                PromisedDate    = PromisedDate,
                                RevPromisedDate = RevPromisedDate,
                                ReadyDateTime   = ReadyDateTime,
                                AccountID       = obj.AccountId,
                                DealerID        = obj.DealerID,

                                CreatedBy    = obj.UserId,
                                CreationDate = DateTime.Now
                            };
                            context.Entry(dt).State = EntityState.Added;
                            context.SaveChanges();



                            InsertIntoTblDtl(JobCardNo, obj);
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
        }