public long AddDesignation(designation designation)
        {
            try
            {
                designation insertDesignation = new designation
                {
                    sales_designation      = designation.sales_designation,
                    sales_person_type_code = designation.sales_person_type_code,
                    parent_designation_id  = designation.parent_designation_id,
                    sales_type_id          = designation.sales_type_id,
                    created_by             = designation.created_by,
                    updated_by             = designation.updated_by,
                    created_date           = designation.created_date,
                    updated_date           = designation.updated_date
                };
                _entities.designations.Add((insertDesignation));
                _entities.SaveChanges();

                long lastInsertId = insertDesignation.sales_designation_id;
                return(lastInsertId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public long AddProductVersion(product_version product_version, long created_by)
        {
            try
            {
                product_version insert_product_version = new product_version
                {
                    product_version_name = product_version.product_version_name,
                    created_by           = created_by,
                    created_date         = DateTime.Now,
                    updated_by           = created_by,
                    updated_date         = DateTime.Now,
                    is_active            = true,
                    is_deleted           = false,
                };

                _entities.product_version.Add(insert_product_version);
                _entities.SaveChanges();
                long last_insert_id = insert_product_version.product_version_id;
                return(last_insert_id);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public long PartyJournalEntry(string transactionType, long partyId, decimal transactionAmount, string remarks, long userId, string documentCode)
        {
            try
            {
                // GET TRANSACTION CONFIGURATION
                var tranConfig = _entities.transaction_configuration.FirstOrDefault(w => w.transaction_type == transactionType);
                if (tranConfig != null)
                {
                    party_journal partyJournal = new party_journal
                    {
                        transaction_date = DateTime.Now,
                        transaction_type = transactionType,
                        party_id         = partyId,
                        opening_balance  = 0,
                        dr_amount        = 0,
                        cr_amount        = 0,
                        closing_balance  = 0,
                        remarks          = remarks,
                        created_by       = userId,
                        document_code    = documentCode,
                        created_date     = DateTime.Now,
                        updated_by       = userId,
                        updated_date     = DateTime.Now,
                    };

                    // GET OPENNIG BALANCE
                    var partyTransaction =
                        _entities.party_journal.Where(w => w.party_id == partyId)
                        .OrderByDescending(o => o.party_journal_id)
                        .FirstOrDefault();
                    decimal closingBalance = 0;
                    if (partyTransaction != null)
                    {
                        closingBalance = partyTransaction.closing_balance ?? 0;
                    }

                    partyJournal.opening_balance = closingBalance;
                    // DEBIT OR CREDIT
                    if (tranConfig.is_dr ?? false)
                    {
                        partyJournal.dr_amount = transactionAmount;
                    }
                    else if (tranConfig.is_cr ?? false)
                    {
                        partyJournal.cr_amount = transactionAmount;
                    }
                    partyJournal.closing_balance = partyJournal.opening_balance + partyJournal.dr_amount - partyJournal.cr_amount;

                    // INSERT PARTY JOURNAL
                    _entities.party_journal.Add(partyJournal);
                    _entities.SaveChanges();
                    return(partyJournal.party_journal_id);
                }
            }
            catch (Exception)
            {
                return(0);
            }
            return(0);
        }
Esempio n. 4
0
 public long AddProductCategory(product_category product_category)
 {
     try
     {
         product_category insert_product_category = new product_category
         {
             product_category_name = product_category.product_category_name,
             product_category_code = product_category.product_category_code,
             //created_by =
             created_date = DateTime.Now,
             //updated_by =
             updated_date = DateTime.Now,
             is_active    = true,
             is_deleted   = false,
         };
         _entities.product_category.Add(insert_product_category);
         _entities.SaveChanges();
         long last_insert_id = insert_product_category.product_category_id;
         return(last_insert_id);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 5
0
 public long AddUser(user aUser)
 {
     try
     {
         var hashPassword = PasswordHash.HashPassword(aUser.password);
         var newUser      = new user
         {
             full_name   = aUser.full_name,
             password    = hashPassword,
             role_id     = aUser.role_id,
             login_name  = aUser.login_name,
             branch_id   = aUser.branch_id,
             party_id    = aUser.party_id,
             company_id  = aUser.company_id,
             is_new_pass = aUser.is_new_pass,
             emp_id      = aUser.emp_id
         };
         _entities.users.Add(newUser);
         _entities.SaveChanges();
         long newUserId = newUser.user_id;
         return(newUserId);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
        public long Addbrand(brand brand)
        {
            try
            {
                brand insert_brand = new brand
                {
                    brand_name = brand.brand_name,
                    //created_by =
                    created_date = DateTime.Now,
                    //updated_by =
                    updated_date = DateTime.Now,
                    is_active    = true,
                    is_deleted   = false,
                };

                _entities.brands.Add(insert_brand);
                _entities.SaveChanges();
                long last_insert_id = insert_brand.brand_id;
                return(last_insert_id);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public bool AddVersionMapping(product_version_mapping productVersion, long create_by)
        {
            try
            {
                var product = new product_version_mapping();


                product.product_version_id = productVersion.product_version_id;
                product.created_by         = create_by;
                product.is_active          = productVersion.is_active;
                product.product_id         = productVersion.product_id;
                product.created_date       = DateTime.Now;
                _entities.product_version_mapping.Add(product);
                int save = _entities.SaveChanges();
                if (save > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 8
0
        public long PostAccessories(inventory_adjustment inventory_adjustment)
        {
            try
            {
                inventory_adjustment insertInventoryAdjustment = new inventory_adjustment
                {
                    adjustment_type     = inventory_adjustment.adjustment_type,
                    warehouse_id        = inventory_adjustment.warehouse_id,
                    contra_warehouse_id = inventory_adjustment.contra_warehouse_id,
                    product_id          = inventory_adjustment.product_id,
                    system_quantity     = inventory_adjustment.system_quantity,
                    physical_quantity   = inventory_adjustment.physical_quantity,
                    adjustment_quantity = inventory_adjustment.adjustment_quantity,
                    status       = inventory_adjustment.status,
                    created_by   = inventory_adjustment.created_by,
                    created_date = inventory_adjustment.created_date,
                    updated_by   = inventory_adjustment.created_by,
                    updated_date = inventory_adjustment.updated_date
                };
                _entities.inventory_adjustment.Add(insertInventoryAdjustment);
                _entities.SaveChanges();

                long last_insert_id = insertInventoryAdjustment.inventory_adjustment_id;
                return(last_insert_id);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public bool InsertControl(control ocontrol)
        {
            try
            {
                control Insert_control = new control();

                Insert_control = new control
                {
                    control_name       = ocontrol.control_name,
                    control_parent_id  = ocontrol.control_parent_id,
                    control_type_id    = ocontrol.control_type_id,
                    control_sort       = ocontrol.control_sort,
                    control_alias      = ocontrol.control_alias,
                    control_controller = ocontrol.control_controller,
                    control_action     = ocontrol.control_action,
                    created_by         = ocontrol.created_by,
                    created_date       = ocontrol.created_date,
                    updated_by         = ocontrol.updated_by,
                    updated_date       = ocontrol.updated_date,
                    company_id         = ocontrol.company_id,
                    is_active          = ocontrol.is_active,
                    Level = ocontrol.Level,
                    icon  = ocontrol.icon
                };
                var exists_control = _entities.controls.Where(con => con.control_name == ocontrol.control_name).FirstOrDefault();
                _entities.controls.Add(Insert_control);
                _entities.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool InsertMailReceiverSetting(mail_receiver_setting oMailReceiverSetting)
 {
     try
     {
         mail_receiver_setting insertMailReceiverSetting = new mail_receiver_setting
         {
             process_code_id = oMailReceiverSetting.process_code_id,
             receiver_name   = oMailReceiverSetting.receiver_name,
             receiver_email  = oMailReceiverSetting.receiver_email,
             created_by      = oMailReceiverSetting.created_by,
             created_date    = oMailReceiverSetting.created_date,
             updated_by      = oMailReceiverSetting.updated_by,
             updated_date    = oMailReceiverSetting.updated_date,
             is_active       = oMailReceiverSetting.is_active,
             is_deleted      = oMailReceiverSetting.is_deleted
         };
         _entities.mail_receiver_setting.Add(insertMailReceiverSetting);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 11
0
        public int Save(SetupBranchViewModel model)
        {
            //var user = Userprovider.CustomeUserManager.GetUserDetails();
            SetupBranch setupBranchEntity = new SetupBranch();
            var         data = _ent.SetupBranches.Where(x => x.BranchName == model.BranchName.Trim() && x.HeadOfficeId == model.HeadOfficeId && x.DeletedDate == null).ToList();

            if (data.Count > 0)
            {
                return(2);
            }
            setupBranchEntity.BranchCode      = model.BranchName;
            setupBranchEntity.HeadOfficeId    = model.HeadOfficeId ?? 0;
            setupBranchEntity.BranchName      = model.BranchName;
            setupBranchEntity.ImageName       = model.ImageName;
            setupBranchEntity.ImagePath       = model.ImagePath;
            setupBranchEntity.Location        = model.Location;
            setupBranchEntity.State           = model.State;
            setupBranchEntity.District        = model.District;
            setupBranchEntity.Metropolitan    = model.Metropolitan;
            setupBranchEntity.SubMetropolitan = model.SubMetropolitan;
            setupBranchEntity.Municipality    = model.Municipality;
            setupBranchEntity.GauPalika       = model.GauPalika;
            setupBranchEntity.WardNo          = model.WardNo;
            setupBranchEntity.EmailId         = model.EmailId;
            setupBranchEntity.Web             = model.Web;
            setupBranchEntity.PhoneNumber     = model.PhoneNumber;
            setupBranchEntity.PanNo           = model.PanNo;
            setupBranchEntity.VatNo           = model.VatNo;
            setupBranchEntity.EstablishDate   = model.EstablishDate;
            setupBranchEntity.RegisteredDate  = model.RegisteredDate;
            if (model.BranchId > 0)
            {
                setupBranchEntity.Status            = model.Status;
                setupBranchEntity.UpdatedBy         = 1;// user.UserId;
                setupBranchEntity.BranchId          = model.BranchId;
                setupBranchEntity.UpdatedDate       = DateTime.UtcNow;
                _ent.Entry(setupBranchEntity).State = EntityState.Modified;
                _ent.Entry(setupBranchEntity).Property(x => x.CreatedBy).IsModified   = false;
                _ent.Entry(setupBranchEntity).Property(x => x.CreatedDate).IsModified = false;
            }
            else
            {
                setupBranchEntity.Status            = true;
                setupBranchEntity.CreatedBy         = 1;// user.UserId;
                setupBranchEntity.CreatedDate       = DateTime.UtcNow;
                _ent.Entry(setupBranchEntity).State = EntityState.Added;
            }
            try
            {
                _ent.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public bool AddProductPriceing(product_price_mapping productPrice, long create_by)
        {
            try
            {
                var priceing = new product_price_mapping();
                priceing.product_id         = productPrice.product_id;
                priceing.product_version_id = productPrice.product_version_id;
                priceing.color_id           = productPrice.color_id;
                priceing.is_active          = productPrice.is_active;
                priceing.created_by         = create_by;
                priceing.created_date       = DateTime.Now;
                priceing.b2b_cost           = productPrice.b2b_cost;
                priceing.corporate_cost     = productPrice.corporate_cost;
                priceing.dealer_cost        = productPrice.dealer_cost;
                priceing.emi_cost           = productPrice.emi_cost;
                priceing.gift_cost          = productPrice.gift_cost;
                priceing.internal_cost      = productPrice.internal_cost;
                priceing.online_cost        = productPrice.online_cost;
                priceing.telco_cost         = productPrice.telco_cost;
                priceing.is_deleted         = false;
                priceing.land_cost          = productPrice.land_cost;
                priceing.fin_cost           = productPrice.fin_cost;
                priceing.incentive_cost     = productPrice.incentive_cost;
                priceing.price_protection   = productPrice.price_protection;
                priceing.promotional_cost   = productPrice.promotional_cost;
                priceing.marketing_cost     = productPrice.marketing_cost;
                priceing.distribution_cost  = productPrice.distribution_cost;
                priceing.qc_cost            = productPrice.qc_cost;
                priceing.we_wifi            = productPrice.we_wifi;
                priceing.we_cloud           = productPrice.we_cloud;
                priceing.cost_price         = productPrice.cost_price;
                priceing.package_cost       = productPrice.package_cost;
                priceing.total_package_cost = productPrice.total_package_cost;
                priceing.amra_margin        = productPrice.amra_margin;
                priceing.dealer_margin      = productPrice.dealer_margin;
                priceing.retailer_margin    = productPrice.retailer_margin;
                priceing.retailer_cost      = productPrice.retailer_cost;
                priceing.mrp_cost           = productPrice.mrp_cost;
                priceing.last_grn_no        = productPrice.last_grn_no;

                _entities.product_price_mapping.Add(priceing);
                int save = _entities.SaveChanges();
                if (save > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 13
0
        public int Save(SetupHeadOfficeViewModel model)
        {
            SetupHaeadOffice headOfficeEntity = new SetupHaeadOffice();
            var data = (_ent.SetupHaeadOffices.Where(h => h.HeadOfficeName == model.HeadOfficeName.Trim() && h.DeletedDate == null)).ToList();

            if (data.Count > 0)
            {
                return(2);
            }
            headOfficeEntity.HeadOfficeCode  = model.HeadOfficeCode;
            headOfficeEntity.HeadOfficeName  = model.HeadOfficeName;
            headOfficeEntity.ImageName       = model.ImageName;
            headOfficeEntity.ImagePath       = model.ImagePath;
            headOfficeEntity.Location        = model.Location;
            headOfficeEntity.State           = model.State;
            headOfficeEntity.District        = model.District;
            headOfficeEntity.Metropolitan    = model.Metropolitan;
            headOfficeEntity.SubMetropolitan = model.SubMetropolitan;
            headOfficeEntity.Municipality    = model.Municipality;
            headOfficeEntity.GauPalika       = model.GauPalika;
            headOfficeEntity.WardNo          = model.WardNo;
            headOfficeEntity.EmailId         = model.EmailId;
            headOfficeEntity.Web             = model.Web;
            headOfficeEntity.PhoneNumber     = model.PhoneNumber;
            headOfficeEntity.PanNo           = model.PanNo;
            headOfficeEntity.VatNo           = model.VatNo;
            headOfficeEntity.EstablishDate   = model.EstablishDate;
            headOfficeEntity.RegisteredDate  = model.RegisteredDate;
            if (model.HeadOfficeId > 0)
            {
                headOfficeEntity.HeadOfficeId      = model.HeadOfficeId;
                headOfficeEntity.Status            = model.Status;
                headOfficeEntity.UpdatedBy         = 1;
                headOfficeEntity.UpdatedDate       = DateTime.UtcNow;
                _ent.Entry(headOfficeEntity).State = EntityState.Modified;
                _ent.Entry(headOfficeEntity).Property(x => x.CreatedBy).IsModified   = false;
                _ent.Entry(headOfficeEntity).Property(x => x.CreatedDate).IsModified = false;
            }
            else
            {
                headOfficeEntity.Status            = true;
                headOfficeEntity.CreatedBy         = 1;
                headOfficeEntity.CreatedDate       = DateTime.UtcNow;
                _ent.Entry(headOfficeEntity).State = EntityState.Added;
            }
            try
            {
                _ent.SaveChanges();
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Esempio n. 14
0
        public ActionResult Create([Bind(Include = "id,Name,Supplier,Title,StartDate,EndDate,TimeH,TimeM,AllDay")] Schedule schedule)
        {
            if (ModelState.IsValid)
            {
                db.Schedules.Add(schedule);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(schedule));
        }
Esempio n. 15
0
 public bool InsertDealerType(dealer_type objDealerType, long created_by)
 {
     try
     {
         _entities.dealer_type.Add(objDealerType);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        public bool AddTermsAndCondition(terms_and_condition objTermsAndCondition)
        {
            try
            {
                _entities.terms_and_condition.Add(objTermsAndCondition);
                _entities.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 17
0
        public long AddEmployee(EmployeeModel employeeModel)
        {
            try
            {
                var insertEmployee = new employee
                {
                    employee_name  = employeeModel.employee_name,
                    date_of_birth  = employeeModel.date_of_birth,
                    date_of_join   = employeeModel.date_of_join,
                    department_id  = employeeModel.department_id,
                    designation_id = employeeModel.designation_id,
                    email_address  = employeeModel.email_address,
                    mobile_number  = employeeModel.mobile_number,
                    address        = employeeModel.address,
                    gender         = employeeModel.gender,
                    marital_status = employeeModel.marital_status,
                    blood_group    = employeeModel.blood_group,
                    region_id      = employeeModel.region_id,
                    area_id        = employeeModel.area_id,
                    territory_id   = employeeModel.territory_id,
                    is_active      = employeeModel.is_active,
                    is_deleted     = false,
                    created_date   = DateTime.Now,
                    created_by     = employeeModel.created_by,
                    updated_date   = DateTime.Now,
                    updated_by     = employeeModel.updated_by
                };
                _entities.employees.Add(insertEmployee);
                _entities.SaveChanges();
                long lastEmployeeId = insertEmployee.employee_id;
                if (employeeModel.is_user)
                {
                    var  hashPassword = PasswordHash.HashPassword(employeeModel.password);
                    user insert_user  = new user
                    {
                        full_name    = employeeModel.employee_name,
                        password     = hashPassword,
                        role_id      = employeeModel.role_id,
                        login_name   = employeeModel.login_name,
                        company_id   = 2,
                        is_new_pass  = true,
                        emp_id       = lastEmployeeId,
                        party_id     = 1,
                        created_by   = employeeModel.created_by,
                        created_date = DateTime.Now,
                        is_active    = true,
                        is_deleted   = false
                    };
                    _entities.users.Add(insert_user);
                    _entities.SaveChanges();

                    return(lastEmployeeId);
                }
                return(0);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Esempio n. 18
0
        public bool InsertBank(bank oBank)
        {
            try
            {
                _entities.banks.Add(oBank);
                _entities.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 19
0
 public long AddCompany(company objCompany)
 {
     try
     {
         _entities.companies.Add(objCompany);
         _entities.SaveChanges();
         long last_insert_id = objCompany.company_id;
         return(last_insert_id);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 20
0
        public bool InsertSbu(sbu oSbu)
        {
            try
            {
                _entities.sbus.Add(oSbu);
                _entities.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 21
0
        public bool InsertPaymentMethod(payment_method payment_method, long?created_by)
        {
            payment_method insert_payment_method = new payment_method
            {
                payment_method_name = payment_method.payment_method_name,
                is_active           = true,
                is_deleted          = false,
                created_by          = created_by,
                created_date        = DateTime.Now,
            };

            _entities.payment_method.Add(insert_payment_method);
            _entities.SaveChanges();
            return(true);
        }
Esempio n. 22
0
 //receiving the verified returned imei
 public bool ReceivingVerifiedIMEI(long return_details_id)
 {
     try
     {
         return_details rdetails = _entities.return_details.Find(return_details_id);
         rdetails.verify_status = true;
         rdetails.verify_date   = DateTime.Now;
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 23
0
 public void CreateClient(Client client)
 {
     using (DMSEntities dmsEntities = this.dmsEntities){
         dmsEntities.Client.Add(client);
         dmsEntities.SaveChanges();
     }
 }
Esempio n. 24
0
        public static bool InsertProduct(Dealer productItem)
        {
            bool status;

            try
            {
                DbContext.Dealers.Add(productItem);
                DbContext.SaveChanges();
                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Esempio n. 25
0
        public IHttpActionResult PostUser(UserDto user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (DMSEntities dbContext = new DMSEntities())
            {
                dbContext.users.Add(new user()
                {
                    //user_id = user.user_id,
                    first_name = user.first_name,
                    last_name  = user.last_name,
                    role       = user.role,
                    location   = user.role,
                    Username   = user.username,
                    Mail       = user.mail,
                    Password   = user.password,
                });



                dbContext.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 26
0
 public void CreateProductionType(ProductionType productionType)
 {
     using (DMSEntities dmsEntities = this.dmsEntities)
     {
         dmsEntities.ProductionType.Add(productionType);
         dmsEntities.SaveChanges();
     }
 }
Esempio n. 27
0
        public long AddSupplier(supplier objSupplier)
        {
            try
            {
                int suppliersCode = _entities.suppliers.Max(sp => (int?)sp.supplier_id) ?? 0;
                suppliersCode++;

                var      spStr           = suppliersCode.ToString().PadLeft(7, '0');
                string   SupplierCode    = "SUP" + "-" + spStr;
                supplier insert_supplier = new supplier
                {
                    supplier_name                   = objSupplier.supplier_name,
                    supplier_code                   = SupplierCode,
                    supplier_type_id                = objSupplier.supplier_type_id,
                    company_address                 = objSupplier.company_address,
                    factory_address                 = objSupplier.factory_address,
                    phone                           = objSupplier.phone,
                    mobile                          = objSupplier.mobile,
                    email                           = objSupplier.email,
                    email2                          = objSupplier.email2,
                    contact_person                  = objSupplier.contact_person,
                    contact_person2                 = objSupplier.contact_person2,
                    total_debit                     = objSupplier.total_debit,
                    total_credit                    = objSupplier.total_credit,
                    balance                         = objSupplier.balance,
                    vat_id                          = objSupplier.vat_id,
                    tin_no                          = objSupplier.tin_no,
                    receiving_company_name          = objSupplier.receiving_company_name,
                    receiving_company_person        = objSupplier.receiving_company_person,
                    receiving_company_contact_email = objSupplier.receiving_company_contact_email,
                    is_active                       = true,
                    is_deleted                      = objSupplier.is_deleted = false,
                    created_by                      = objSupplier.created_by,
                    created_date                    = objSupplier.created_date = DateTime.Now
                };
                _entities.suppliers.Add(insert_supplier);
                _entities.SaveChanges();
                long last_insert_id = insert_supplier.supplier_id;
                return(last_insert_id);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Esempio n. 28
0
 public long AddColor(color color)
 {
     try
     {
         color insert_color = new color
         {
             color_name = color.color_name
         };
         _entities.colors.Add(insert_color);
         _entities.SaveChanges();
         long last_insert_id = insert_color.color_id;
         return(last_insert_id);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 29
0
 public bool InsertSalesType(sales_type objSalesType)
 {
     try
     {
         sales_type sales = new sales_type
         {
             sales_type1 = objSalesType.sales_type1,
             is_active   = objSalesType.is_active,
         };
         _entities.sales_type.Add(sales);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public bool InsertDepartment(department oDepartment)
 {
     try
     {
         department insertdepartment = new department
         {
             department_name = oDepartment.department_name,
             is_active       = oDepartment.is_active,
         };
         _entities.departments.Add(insertdepartment);
         _entities.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }