Esempio n. 1
0
        public static bool DeleteClient(int id)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ClientMaster TblUser = new ClientMaster();
                    var          temp    = context.ClientMasters.Find(id);
                    TblUser = temp == null ? new ClientMaster() : temp;


                    if (temp == null)
                    {
                        return(false);
                    }
                    context.ClientMasters.Remove(TblUser);
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 2
0
 public static int AddEditUserMenu(MenuModel _model)
 {
     try
     {
         using (HJStudioEntities context = new HJStudioEntities())
         {
             context.MenuUserAllocations.Where(x => x.UserId == _model.UserId).ToList().ForEach(x =>
             {
                 context.MenuUserAllocations.Remove(x);
             });
             foreach (var Mid in _model.MenuIdList)
             {
                 if (Mid > 0)
                 {
                     MenuUserAllocation _MenuUserAllocationTable = new MenuUserAllocation();
                     _MenuUserAllocationTable.UserId = _model.UserId;
                     _MenuUserAllocationTable.MenuId = Mid;
                     context.MenuUserAllocations.Add(_MenuUserAllocationTable);
                 }
             }
             context.SaveChanges();
             return(_model.UserId.Value);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        public static bool DeleteProduct(int id)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ProductMaster prod = new ProductMaster();
                    var           temp = context.ProductMasters.Find(id);
                    prod = temp == null ? new ProductMaster() : temp;


                    if (temp == null)
                    {
                        return(false);
                    }
                    context.ProductMasters.Remove(prod);
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 4
0
        public static bool AddProduct(ProductModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ProductMaster prod = new ProductMaster();
                    var           temp = context.ProductMasters.Find(model.ProductId);
                    prod = temp == null ? new ProductMaster() : temp;

                    prod.ProductName        = model.ProductName;
                    prod.ProductDescription = model.ProductDescription;
                    prod.Amount             = model.Amount;

                    if (temp == null)
                    {
                        prod.CreatedBy   = "Admin";
                        prod.CreatedDate = DateTime.Now;
                        context.ProductMasters.Add(prod);
                    }
                    else
                    {
                        prod.ModifiedBy   = "Admin";
                        prod.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 5
0
        public static bool AddEmployee(EmployeeModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    EmployeeMaster emp  = new EmployeeMaster();
                    var            temp = context.EmployeeMasters.Find(model.EmployeeID);
                    emp = temp == null ? new EmployeeMaster() : temp;

                    emp.Name         = model.Name;
                    emp.Address1     = model.Address1;
                    emp.Address2     = model.Address2;
                    emp.EmailId      = model.EmailId;
                    emp.MobileNo     = model.MobileNo;
                    emp.City         = model.City;
                    emp.State        = model.State;
                    emp.Password     = model.Password;
                    emp.UserType     = model.UserType;
                    emp.DailyWages   = model.DailyWages;
                    emp.HalfDayWages = model.HalfDayWages;
                    emp.MonthlyWages = model.MonthlyWages;
                    emp.WagesType    = model.WagesType;
                    if (temp == null)
                    {
                        emp.CreatedBy   = "Admin";
                        emp.CreatedDate = DateTime.Now;
                        emp.Status      = 1;
                        context.EmployeeMasters.Add(emp);
                    }
                    else
                    {
                        emp.ModifiedBy   = "Admin";
                        emp.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 6
0
        public static bool AddClient(ClientModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ClientMaster clt  = new ClientMaster();
                    var          temp = context.ClientMasters.Find(model.ClientID);
                    clt = temp == null ? new ClientMaster() : temp;

                    clt.Name     = model.Name;
                    clt.MobileNo = model.MobileNo;
                    clt.EmailId  = model.EmailId;
                    clt.Address1 = model.Address1;
                    clt.Address2 = model.Address2;
                    clt.City     = model.City;
                    clt.State    = model.State;
                    clt.Refrence = model.Refrence;

                    if (temp == null)
                    {
                        clt.CreatedBy   = "Admin";
                        clt.CreatedDate = DateTime.Now;
                        context.ClientMasters.Add(clt);
                    }
                    else
                    {
                        clt.ModifiedBy   = "Admin";
                        clt.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 7
0
        public static bool AddExpense(ExpenseModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    Expense exp  = new Expense();
                    var     temp = context.Expenses.Find(model.ExpenseID);
                    exp = temp == null ? new Expense() : temp;

                    exp.Description = model.Description;
                    exp.EmployeeID  = model.EmployeeID;
                    exp.BankName    = model.BankName;
                    exp.IsBank      = model.IsBank;
                    exp.IFSCCode    = model.IFSCCode;
                    exp.ChequeNo    = model.ChequeNo;
                    exp.Amount      = model.Amount;

                    if (temp == null)
                    {
                        exp.CreatedBy   = "Admin";
                        exp.CreatedDate = DateTime.Now;
                        context.Expenses.Add(exp);
                    }
                    else
                    {
                        exp.Modifiedby   = "Admin";
                        exp.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 8
0
        public static int EnquiryFollowUpModel(EnquiryFollowUpModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    EnquiryFollowUp ef = new EnquiryFollowUp();
                    //var temp1 = context.EnquiryFollowUps.Find(model.InquiryId);
                    // ef = temp1 == null ? new EnquiryFollowUp() : temp1;

                    ef.EnquiryId       = model.InquiryId;
                    ef.EnquiryStatus   = model.InquiryStatus;
                    ef.Remarks         = model.Remarks;
                    ef.NextFolowupDate = model.NextFolowupDate;
                    context.EnquiryFollowUps.Add(ef);
                    context.SaveChanges();
                }
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Esempio n. 9
0
        public static bool ActivatetEmployee(int id)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    EmployeeMaster TblUser = new EmployeeMaster();
                    var            temp    = context.EmployeeMasters.Find(id);
                    TblUser        = temp == null ? new EmployeeMaster() : temp;
                    TblUser.Status = 1;

                    if (temp == null)
                    {
                        return(false);
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 10
0
        public static bool AddQuotation(QuotationModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ClientMaster clt        = new ClientMaster();
                    var          Clienttemp = context.ClientMasters.Find(model.ClientID);
                    clt = Clienttemp == null ? new ClientMaster() : Clienttemp;

                    clt.Name     = model.Name;
                    clt.MobileNo = model.MobileNo;
                    clt.EmailId  = model.EmailId;
                    clt.Address1 = model.Address1;
                    clt.Address2 = model.Address2;
                    clt.City     = model.City;
                    clt.State    = model.State;
                    clt.Refrence = model.Refrence;



                    if (Clienttemp == null)
                    {
                        clt.CreatedBy   = "Admin";
                        clt.CreatedDate = DateTime.Now;
                        context.ClientMasters.Add(clt);
                    }
                    else
                    {
                        clt.ModifiedBy   = "Admin";
                        clt.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    int ClientID = clt.ClientID;


                    QuotationMaster _Quotation = new QuotationMaster();
                    var             temp       = context.QuotationMasters.Find(model.QuotationID);
                    _Quotation = temp == null ? new QuotationMaster() : temp;

                    if (temp != null)
                    {
                    }

                    _Quotation.QuotationDate   = model.QuotationDate;
                    _Quotation.EventStartDate  = model.EventStartDate;
                    _Quotation.EventDays       = model.EventDays;
                    _Quotation.Remark          = model.Remark;
                    _Quotation.QuotationAmount = model.QuotationAmount;
                    _Quotation.Discount        = model.Discount;
                    _Quotation.FinalAmount     = model.FinalAmount;
                    _Quotation.ClientID        = ClientID;
                    _Quotation.Name            = model.Name;
                    _Quotation.MobileNo        = model.MobileNo;
                    _Quotation.EmailId         = model.EmailId;
                    _Quotation.Address1        = model.Address1;
                    _Quotation.Address2        = model.Address2;
                    _Quotation.City            = model.City;
                    _Quotation.State           = model.State;
                    _Quotation.Refrence        = model.Refrence;
                    _Quotation.Status          = model.Status;
                    List <QuotationDay> _QuotationDay = new List <Data.QuotationDay>();
                    if (model.QuotationDayList != null)
                    {
                        foreach (var d in model.QuotationDayList)
                        {
                            List <EmployeeQuotationDay> _EmployeeQuotationDay = new List <EmployeeQuotationDay>();
                            if (d.EmployeeQuotationDayList != null)
                            {
                                foreach (var e in d.EmployeeQuotationDayList)
                                {
                                    if (e.IsDelete == false && e.EmployeeID > 0)
                                    {
                                        _EmployeeQuotationDay.Add(new EmployeeQuotationDay
                                        {
                                            EmployeeID   = e.EmployeeID,
                                            Wages        = e.Wages,
                                            EmployeeRole = e.EmployeeRole,
                                        });
                                    }
                                }
                            }
                            _QuotationDay.Add(new QuotationDay
                            {
                                EventName             = d.EventName,
                                EventDate             = d.EventDate,
                                StartTime             = d.StartTime,
                                EndTime               = d.EndTime,
                                Remarks               = d.Remarks,
                                Address1              = d.Address1,
                                Address2              = d.Address2,
                                City                  = d.City,
                                State                 = d.State,
                                ClientMobileNo        = d.ClientMobileNo,
                                EmployeeQuotationDays = _EmployeeQuotationDay
                            });
                        }
                    }

                    _Quotation.QuotationDays = _QuotationDay;

                    List <ProductQuotation> _ProductQuotation = new List <ProductQuotation>();
                    if (model.ProductQuotationList != null)
                    {
                        foreach (var p in model.ProductQuotationList)
                        {
                            if (p.ProductID > 0)
                            {
                                _ProductQuotation.Add(new ProductQuotation
                                {
                                    ProductID   = p.ProductID,
                                    Quantity    = p.Quantity,
                                    Amount      = p.Amount,
                                    TotalAmount = p.TotalAmount,
                                    Remark      = p.Remark,
                                });
                            }
                        }
                    }
                    _Quotation.ProductQuotations = _ProductQuotation;

                    if (temp == null)
                    {
                        _Quotation.CreatedBy   = CommanModel.LoginUserDetails.EmployeeID;
                        _Quotation.CreatedDate = DateTime.Now;
                        context.QuotationMasters.Add(_Quotation);
                    }
                    else
                    {
                        _Quotation.ModifiedBy   = CommanModel.LoginUserDetails.EmployeeID;
                        _Quotation.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 11
0
        public static bool AddEnquiry(EnquiryModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ClientMaster clt  = new ClientMaster();
                    var          temp = context.ClientMasters.Find(model.client.ClientID);
                    clt = temp == null ? new ClientMaster() : temp;

                    clt.Name     = model.client.Name;
                    clt.MobileNo = model.client.MobileNo;
                    clt.EmailId  = model.client.EmailId;
                    clt.Address1 = model.client.Address1;
                    clt.Address2 = model.client.Address2;
                    clt.City     = model.client.City;
                    clt.State    = model.client.State;
                    clt.Refrence = model.client.Refrence;



                    if (temp == null)
                    {
                        clt.CreatedBy   = "Admin";
                        clt.CreatedDate = DateTime.Now;
                        context.ClientMasters.Add(clt);
                    }
                    else
                    {
                        clt.ModifiedBy   = "Admin";
                        clt.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    if (temp == null)
                    {
                        model.client.ClientID = clt.ClientID;
                    }


                    FunctionDetail flt   = new FunctionDetail();
                    var            temp1 = context.FunctionDetails.Find(model.Id);
                    flt = temp1 == null ? new FunctionDetail() : temp1;

                    flt.FunctionName        = model.FunctionName;
                    flt.FunctionDescription = model.FunctionDescription;
                    flt.FunctionDate        = model.FunctionDate;
                    flt.City     = model.City;
                    flt.State    = model.State;
                    flt.Address  = model.Address;
                    flt.ClientId = model.client.ClientID;

                    if (temp1 == null)
                    {
                        flt.CreatedDate = DateTime.Now;
                        flt.CreatedBy   = "Admin";
                        context.FunctionDetails.Add(flt);
                    }
                    else
                    {
                        flt.ModifiedDate = DateTime.Now;
                        flt.ModifiedBy   = "Admin";
                    }

                    EnquiryFollowUp EF = new EnquiryFollowUp();
                    EF.NextFolowupDate = model.FunctionDate;
                    EF.EnquiryId       = flt.Id;
                    EF.CreatedDate     = DateTime.Now;
                    EF.CreatedBy       = "Admin";
                    EF.EnquiryStatus   = 2;
                    context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }