public int AddProductPrice(tbl_ProductPrice objProductPrice)
 {
     try
     {
         isExist        = 0;
         dtRecords      = new DataTable();
         objSKSEntities = new SKSEntities();
         isExist        = (from ProductPrice in objSKSEntities.tbl_ProductPrice where (ProductPrice.FK_ProductMasterID == objProductPrice.FK_ProductMasterID && ProductPrice.IsDeleted == false) select ProductPrice.Id).SingleOrDefault();;
         if (isExist > 0)
         {
             return(isExist);
         }
         else
         {
             objSKSEntities.tbl_ProductPrice.Add(objProductPrice);
             objSKSEntities.SaveChanges();
             return(isExist);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dtRecords.Dispose();
     }
 }
    public void DeleteorEnableDisableCompanyProductPrice(int ProductID, bool blnTrueFalse, bool blnDelete)
    {
        try
        {
            objSKSEntities = new SKSEntities();

            objProductPrice = objSKSEntities.tbl_ProductPrice.SingleOrDefault(x => x.Id == ProductID); //returns a single item.

            if (objProductPrice != null)
            {
                objProductPrice.IsActive  = blnTrueFalse;
                objProductPrice.IsDeleted = blnDelete;
                objSKSEntities.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            objSKSEntities  = null;
            objProductPrice = null;
        }
    }
 public int AddCompany(tbl_CompanyMaster objCompanyMaster)
 {
     try
     {
         isExist        = 0;
         dtRecords      = new DataTable();
         objSKSEntities = new SKSEntities();
         isExist        = (from CompanyMaster in objSKSEntities.tbl_CompanyMaster where (CompanyMaster.Name == objCompanyMaster.Name && CompanyMaster.IsDeleted == false) select CompanyMaster.Id).SingleOrDefault();;
         if (isExist > 0)
         {
             return(isExist);
         }
         else
         {
             objSKSEntities.tbl_CompanyMaster.Add(objCompanyMaster);
             objSKSEntities.SaveChanges();
             return(isExist);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dtRecords.Dispose();
     }
 }
 public void AddBillDetails(tbl_BillDetails objBillDetails)
 {
     try
     {
         objSKSEntities = new SKSEntities();
         objSKSEntities.tbl_BillDetails.Add(objBillDetails);
         objSKSEntities.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         objSKSEntities = null;
     }
 }
 public void AddShippingCustomerDetails(tbl_CustomerShippingAddress objCustomerShippingAddress)
 {
     try
     {
         objSKSEntities = new SKSEntities();
         objSKSEntities.tbl_CustomerShippingAddress.Add(objCustomerShippingAddress);
         objSKSEntities.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         objSKSEntities = null;
     }
 }
 public void AddItemInBillDetailsTemp(tbl_BillDetails_temp objtbl_BillDetails_temp)
 {
     try
     {
         objSKSEntities = new SKSEntities();
         objSKSEntities.tbl_BillDetails_temp.Add(objtbl_BillDetails_temp);
         objSKSEntities.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         objSKSEntities = null;
     }
 }
 public Int64 CreateInvoicenGenerateInvoiceNo(tbl_BillMaster objBillMaster)
 {
     try
     {
         objSKSEntities = new SKSEntities();
         objSKSEntities.tbl_BillMaster.Add(objBillMaster);
         objSKSEntities.SaveChanges();
         return(objBillMaster.BillId);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         objSKSEntities = null;
     }
 }
    public void DeleteItemInBillDetailsTemp(Int64 TempBillDetailsID, string GUID)
    {
        try
        {
            objSKSEntities = new SKSEntities();

            var itemToRemove = objSKSEntities.tbl_BillDetails_temp.SingleOrDefault(x => x.Id == TempBillDetailsID && x.GUID == GUID); //returns a single item.

            if (itemToRemove != null)
            {
                objSKSEntities.tbl_BillDetails_temp.Remove(itemToRemove);
                objSKSEntities.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            objSKSEntities = null;
        }
    }
    public void DeleteorEnableDisableCompany(int CompanyID, bool blnTrueFalse, bool blnDelete)
    {
        try
        {
            objSKSEntities = new SKSEntities();

            objCompanyMaster = objSKSEntities.tbl_CompanyMaster.SingleOrDefault(x => x.Id == CompanyID); //returns a single item.

            if (objCompanyMaster != null)
            {
                objCompanyMaster.IsActive  = blnTrueFalse;
                objCompanyMaster.IsDeleted = blnDelete;
                objSKSEntities.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            objSKSEntities = null;
        }
    }