public HttpResponseMessage SupplierAdd(SupplierModel _SupplierModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { TBL_SUPPLIER sup = new TBL_SUPPLIER(); sup.SUPPLIER_CODE = _SupplierModel.SUPPLIER_CODE; sup.SUPPLIER_NAME = _SupplierModel.SUPPLIER_NAME; sup.SEARCH_CODE = _SupplierModel.SEARCH_CODE; sup.VAT_NO = _SupplierModel.VAT_NO; sup.CST_NO = _SupplierModel.CST_NO; sup.TIN_NO = _SupplierModel.TIN_NO; sup.PAN_NO = _SupplierModel.PAN_NO; sup.ADDRESS_1 = _SupplierModel.ADDRESS_1; sup.ADDRESS_2 = _SupplierModel.ADDRESS_2; sup.CITY = _SupplierModel.CITY; sup.STATE = _SupplierModel.STATE; sup.ZIP_CODE = _SupplierModel.ZIP_CODE; sup.OPENING_BALANCE = _SupplierModel.OPENING_BALANCE; sup.IS_PREFERRED_SUPPLIER = _SupplierModel.IS_PREFERRED_SUPPLIER; sup.IS_ACTIVE = _SupplierModel.IS_ACTIVE; sup.PAYMENT_SETTLED = _SupplierModel.PAYMENT_SETTLED; sup.IMAGE_PATH = _SupplierModel.IMAGE_PATH; sup.COMPANY_ID = _SupplierModel.COMPANY_ID; sup.SUPPLIER_ID = _SupplierModel.SUPPLIER_ID; sup.CONTACT_FRIST_NAME = _SupplierModel.CONTACT_FRIST_NAME; sup.CONTACT_LAST_NAME = _SupplierModel.CONTACT_LAST_NAME; sup.CONTACT_TELEPHONE_NO = _SupplierModel.CONTACT_TELEPHONE_NO; sup.CONTACT_FAX_NO = _SupplierModel.CONTACT_FAX_NO; sup.CONTACT_MOBILE_NO = _SupplierModel.CONTACT_MOBILE_NO; sup.CONTACT_WEBSITE = _SupplierModel.CONTACT_WEBSITE; sup.CONTACT_EMAIL = _SupplierModel.CONTACT_EMAIL; sup.IS_DELETE = false; db.TBL_SUPPLIER.Add(sup); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage DeleteSupp(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_SUPPLIER where a.SUPPLIER_ID == id select a).FirstOrDefault(); str.IS_DELETE = true; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetStocktDetails(int companyid, int godownid, int itemid) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_STOCK_TRANSFER join b in db.TBL_ITEMS on a.ITEM_ID equals b.ITEM_ID where a.COMPANY_ID == companyid && a.FROM_GODOWN_ID == godownid || a.TO_GODOWN_ID == godownid && a.ITEM_ID == itemid && a.IS_DELETE == false // where a.SERCH_CODE == Code || a.BARCODE == Code || a.ITEM_NAME == Code select new StocktransferModel { STOCK_TRANSFER_ID = a.STOCK_TRANSFER_ID, BUSINESS_LOCATION = a.BUSINESS_LOCATION, BUSINESS_LOCATION_ID = a.BUSINESS_LOCATION_ID, FROM_GODOWN_ID = a.FROM_GODOWN_ID, RECEIVED_BY_ID = a.RECEIVED_BY_ID, TO_GODOWN_ID = a.TO_GODOWN_ID, TOTAL_STOCK_QNT = a.TOTAL_STOCK_QNT, DATE = a.DATE, EMAIL = a.EMAIL, FROM_GODOWN = a.FROM_GODOWN, IS_SEND = a.IS_SEND, COMPANY_ID = a.COMPANY_ID, ITEM_ID = a.ITEM_ID, RECEIVED_BY = a.RECEIVED_BY, STOCK_TRANSFER_NUMBER = a.STOCK_TRANSFER_NUMBER, TO_GODOWN = a.TO_GODOW, BARCODE = a.BARCODE, ITEM_NAME = a.ITEM_NAME, SEARCH_CODE = a.SEARCH_CODE, TRANS_QUANTITY = a.TRANS_QUANTITY, IS_NEGATIVE_STOCK_MESSAGE = a.IS_NEGATIVE_STOCK_MESSAGE, OPN_QNT = b.OPN_QNT, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage ChngStocktransfer(StocktransferModel _StocktransferModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_STOCK_TRANSFER where a.STOCK_TRANSFER_ID == _StocktransferModel.STOCK_TRANSFER_ID select a).FirstOrDefault(); str.TOTAL_STOCK_QNT = _StocktransferModel.CHNG_QNT; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetLoyaltyNo(string CompanyId) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { string code = ""; string value = Convert.ToString(db.TBL_AUTO_GENERATE_CODE_FOR_LOYALTY .OrderByDescending(p => p.AUTO_GENERATE_CODE_FOR_LOYALTY) .Select(r => r.AUTO_GENERATE_CODE_FOR_LOYALTY) .First()); var str = (from a in db.TBL_CUSTOMER where a.LOYALTY_NO == value select a).ToList(); if (str.Count != 0) { string dd = Convert.ToString(value); string aaa = dd.Substring(2, 5); int xx = Convert.ToInt32(aaa); int noo = Convert.ToInt32(xx + 1); code = "L-" + noo.ToString("D6"); TBL_AUTO_GENERATE_CODE _code = new TBL_AUTO_GENERATE_CODE(); _code.AUTO_GENERATE_CODE = code; _code.COMPANY_ID = Convert.ToInt64(CompanyId); _code.DEFINE_CODE = ""; _code.USER_ID = 0; db.TBL_AUTO_GENERATE_CODE.Add(_code); db.SaveChanges(); } else { string dd = Convert.ToString(value); string aaa = dd.Substring(2, 5); int xx = Convert.ToInt32(aaa); code = "L-" + xx.ToString("D6"); } return(Request.CreateResponse(HttpStatusCode.OK, code)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage LoyaltyAdd(LoyaltyModel _LoyaltyModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { if (_LoyaltyModel.LOYALTI_ID == null || _LoyaltyModel.LOYALTI_ID == 0) { TBL_LOYALTY gd = new TBL_LOYALTY(); gd.COLLECTION = _LoyaltyModel.COLLECTION; gd.COMPANY_ID = _LoyaltyModel.COMPANY_ID; gd.CUSTOMERGROUP = _LoyaltyModel.CUSTOMERGROUP; gd.FROMDATE = DateTime.Now; gd.IS_DELETE = false; gd.ISACTIVE = _LoyaltyModel.ISACTIVE; gd.ISDEFAULT = _LoyaltyModel.ISDEFAULT; gd.SETTINGSNAME = _LoyaltyModel.SETTINGSNAME; gd.TODATE = DateTime.Now; gd.WEIGHTAGE = _LoyaltyModel.WEIGHTAGE; db.TBL_LOYALTY.Add(gd); db.SaveChanges(); if (_LoyaltyModel.ListGrid1.Count > 0) { foreach (var item in _LoyaltyModel.ListGrid1) { TBL_LOYALTY_Exceedings tbLexceed = new TBL_LOYALTY_Exceedings(); tbLexceed.Company_ID = _LoyaltyModel.COMPANY_ID; tbLexceed.Flatpoints = item.FlatPoints; tbLexceed.InvoiveExceeding = item.InvoiceExceeding; tbLexceed.LOYALTY_ID = item.LOYALTI_ID; db.TBL_LOYALTY_Exceedings.Add(tbLexceed); db.SaveChanges(); } } } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage EditSalesReturn(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_SALES_RETURN where a.SALES_RETURN_ID == id && a.IS_DELETE == false select new SalesReturnModel { SALES_RETURN_ID = a.SALES_RETURN_ID, BUSINESS_LOCATION = a.BUSINESS_LOCATION, SALES_RETURN_NO = a.SALES_RETURN_NO, BARCODE = a.BARCODE, ITEM_NAME = a.ITEM_NAME, IS_WITHOUT_INVOICE = a.IS_WITHOUT_INVOICE, RETURN_DATE = a.RETURN_DATE, GODOWN = a.GODOWN, CUSTOMER_ID = a.CUSTOMER_ID, OUTSTANDING_BALANCE = a.OUTSTANDING_BALANCE, INVOICE_NO = a.INVOICE_NO, REFERENCE_NUMBER = a.REFERENCE_NUMBER, TAX_AMOUNT = a.TAX_AMOUNT, FREIGHT_CHARGE = a.FREIGHT_CHARGE, PACKING_CHARGE = a.PACKING_CHARGE, TOTAL_AMOUNT = a.TOTAL_AMOUNT, ROUND_OFF_AMOUNT = a.ROUND_OFF_AMOUNT, GRAND_TOTAL = a.GRAND_TOTAL, SUBSIDY_AMOUN = a.SUBSIDY_AMOUN, CUS_PENDING_AMOUNT = a.CUS_PENDING_AMOUNT, NOTES = a.NOTES, SALES_EXECUTIVE = a.SALES_EXECUTIVE, SEARCH_CODE = a.SEARCH_CODE, COMPANY_ID = a.COMPANY_ID, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage TransferCashAdd(CashRegModel crm) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { TBL_TRANSFER_CASH tc = new TBL_TRANSFER_CASH(); tc.COMPANY_ID = crm.COMPANY_ID; tc.BUSINESS_LOC_ID = crm.BUSINESS_LOCATION_ID; tc.BUSINESS_LOC = crm.BUSINESS_LOCATION; tc.CASH_TRANSFER_NUMBER = crm.TRANSFER_CODE; tc.FROM_CASH_REGISTER = crm.FROM_TRAN_CASH_REGISTER; tc.TO_CASH_REGISTER = crm.TO_TRAN_CASH_REGISTER; tc.TOTAL_TRANSFERED_AMOUNT = crm.CASH_TO_TRANSFER; tc.TRANSFER_DATE = crm.TRANSFER_DATE; tc.IS_TRANSFER_CASH_REGISTER = crm.IS_TRANSFER_CASH_REGISTER; tc.CASH_REGISTERID_FROM = crm.CASH_REGISTERID_FROM; tc.CASH_REGISTERID_TO = crm.CASH_REGISTERID_TO; tc.STATUS = "Approved"; tc.IS_DELETE = false; db.TBL_TRANSFER_CASH.Add(tc); db.SaveChanges(); var str = (from a in db.TBL_NEWCASHREGISTER where a.CASH_REGISTERID == crm.CASH_REGISTERID_FROM select a).FirstOrDefault(); str.CASH_AMOUNT = crm.CURRENT_CASH - crm.CASH_TO_TRANSFER; var str1 = (from a in db.TBL_NEWCASHREGISTER where a.CASH_REGISTERID == crm.CASH_REGISTERID_TO select a).FirstOrDefault(); str1.CASH_AMOUNT = str1.CASH_AMOUNT + crm.CASH_TO_TRANSFER; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage PurchaseOrdList(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_PO_PAYMENT where a.COMPANY_ID == id && a.IS_DELETE == false select new POModel { //BAR_CODE = a.BAR_CODE, BUSINESS_LOCATION = a.BUSINESS_LOCATION_ID, COMPANY_ID = a.COMPANY_ID, DELIVER = a.DELIVER_ID, DELIVER_TO = a.DELIVER_TO, DELIVERY_DATE = a.DELIVERY_DATE, IS_SEND_MAIL = a.IS_SEND_MAIL, //ITEM_NAME = a.ITEM_NAME, PO_ID = a.PO_ID, PO_NUMBER1 = a.PO_NUMBER, //SEARCH_CODE = a.SEARCH_CODE, SUPPLIER_NAME = a.SUPPLIER_NAME, SUPPLIER = a.SUPPLIER_ID, SUPPLIER_EMAIL = a.SUPPLIER_MAIL, TERMS = a.TERMS, TOTAL_AMOUNT = a.TOTAL_AMOUNT, TOTAL_TAX = a.TOTAL_TAX, PO_DATE = a.PO_DATE, PO_STATUS = a.PO_STATUS //PO_TYPE=a.PO_TYPE, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage UpdateSalesReturn(SalesReturnModel _SalesReturnModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var re = (from a in db.TBL_SALES_RETURN where a.SALES_RETURN_ID == _SalesReturnModel.SALES_RETURN_ID select a).FirstOrDefault(); re.BUSINESS_LOCATION = _SalesReturnModel.BUSINESS_LOCATION; re.SALES_RETURN_NO = _SalesReturnModel.SALES_RETURN_NO; re.BARCODE = _SalesReturnModel.BARCODE; re.ITEM_NAME = _SalesReturnModel.ITEM_NAME; re.IS_WITHOUT_INVOICE = _SalesReturnModel.IS_WITHOUT_INVOICE; re.RETURN_DATE = System.DateTime.Now; re.GODOWN = _SalesReturnModel.GODOWN; re.CUSTOMER_ID = _SalesReturnModel.CUSTOMER_ID; re.OUTSTANDING_BALANCE = _SalesReturnModel.OUTSTANDING_BALANCE; re.INVOICE_NO = _SalesReturnModel.INVOICE_NO; re.REFERENCE_NUMBER = _SalesReturnModel.REFERENCE_NUMBER; re.TAX_AMOUNT = _SalesReturnModel.TAX_AMOUNT; re.FREIGHT_CHARGE = _SalesReturnModel.FREIGHT_CHARGE; re.PACKING_CHARGE = _SalesReturnModel.PACKING_CHARGE; re.TOTAL_AMOUNT = _SalesReturnModel.TOTAL_AMOUNT; re.ROUND_OFF_AMOUNT = _SalesReturnModel.ROUND_OFF_AMOUNT; re.GRAND_TOTAL = _SalesReturnModel.GRAND_TOTAL; re.COMPANY_ID = _SalesReturnModel.COMPANY_ID; re.SUBSIDY_AMOUN = _SalesReturnModel.SUBSIDY_AMOUN; re.CUS_PENDING_AMOUNT = _SalesReturnModel.CUS_PENDING_AMOUNT; re.NOTES = _SalesReturnModel.NOTES; re.SEARCH_CODE = _SalesReturnModel.SEARCH_CODE; re.SALES_EXECUTIVE = _SalesReturnModel.SALES_EXECUTIVE; re.IS_DELETE = false; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, re)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage BankUpdate(BankModel _BankModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { if (_BankModel.BANK_ID != null || _BankModel.BANK_ID != 0) { var gd = (from a in db.TBL_BANK where a.BANK_ID == _BankModel.BANK_ID select a).FirstOrDefault(); gd.ADDRESS_1 = _BankModel.ADDRESS_1; gd.ADDRESS_2 = _BankModel.ADDRESS_2; gd.BANK_CODE = _BankModel.BANK_CODE; gd.BANK_ID = _BankModel.BANK_ID; gd.BANK_NAME = _BankModel.BANK_NAME; gd.CITY = _BankModel.CITY; gd.COMPANY_ID = _BankModel.COMPANY_ID; gd.COUNTRY = _BankModel.COUNTRY; gd.EMAIL = _BankModel.EMAIL; gd.FAX_NUMBER = _BankModel.FAX_NUMBER; gd.IFSC_CODE = _BankModel.IFSC_CODE; gd.IS_DELETED = false; gd.MOBILE_NUMBER = _BankModel.MOBILE_NUMBER; gd.PHONE_NUMBER = _BankModel.PHONE_NUMBER; gd.PIN_CODE = _BankModel.PIN_CODE; gd.STATE = _BankModel.STATE; gd.WEBSITE = _BankModel.WEBSITE; db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GodownAdd(GodownModel _GodownModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { if (_GodownModel.GODOWN_ID == null || _GodownModel.GODOWN_ID == 0) { TBL_GODOWN gd = new TBL_GODOWN(); gd.COMPANY_ID = _GodownModel.COMPANY_ID; gd.GODOWN_NAME = _GodownModel.GODOWN_NAME; gd.GOSOWN_DESCRIPTION = _GodownModel.GOSOWN_DESCRIPTION; gd.IS_ACTIVE = _GodownModel.IS_ACTIVE; gd.IS_DELETE = false; gd.IS_DEFAULT_GODOWN = false; db.TBL_GODOWN.Add(gd); db.SaveChanges(); } else { var str = (from a in db.TBL_GODOWN where a.GODOWN_ID == _GodownModel.GODOWN_ID select a).FirstOrDefault(); str.COMPANY_ID = _GodownModel.COMPANY_ID; str.GODOWN_NAME = _GodownModel.GODOWN_NAME; str.GOSOWN_DESCRIPTION = _GodownModel.GOSOWN_DESCRIPTION; str.IS_ACTIVE = _GodownModel.IS_ACTIVE; str.IS_DELETE = false; str.IS_DEFAULT_GODOWN = false; db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage UpdateStocktransfer(StocktransferModel _StocktransferModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var _stock = (from a in db.TBL_STOCK_TRANSFER where a.STOCK_TRANSFER_ID == _StocktransferModel.STOCK_TRANSFER_ID select a).FirstOrDefault(); _stock.COMPANY_ID = _StocktransferModel.COMPANY_ID; _stock.BUSINESS_LOCATION = _StocktransferModel.BUSINESS_LOCATION; _stock.BUSINESS_LOCATION_ID = _StocktransferModel.BUSINESS_LOCATION_ID; _stock.DATE = DateTime.Now; _stock.BARCODE = _StocktransferModel.BARCODE; _stock.SEARCH_CODE = _StocktransferModel.SEARCH_CODE; _stock.ITEM_NAME = _StocktransferModel.ITEM_NAME; _stock.EMAIL = _StocktransferModel.EMAIL; _stock.FROM_GODOWN = _StocktransferModel.FROM_GODOWN; _stock.FROM_GODOWN_ID = _StocktransferModel.FROM_GODOWN_ID; _stock.IS_SEND = _StocktransferModel.IS_SEND; _stock.RECEIVED_BY_ID = _StocktransferModel.RECEIVED_BY_ID; _stock.RECEIVED_BY = _StocktransferModel.RECEIVED_BY; _stock.STOCK_TRANSFER_ID = _StocktransferModel.STOCK_TRANSFER_ID; _stock.STOCK_TRANSFER_NUMBER = _StocktransferModel.STOCK_TRANSFER_NUMBER; _stock.TO_GODOWN_ID = _StocktransferModel.TO_GODOWN_ID; _stock.TO_GODOW = _StocktransferModel.TO_GODOWN; _stock.TOTAL_STOCK_QNT = _StocktransferModel.TOTAL_STOCK_QNT; _stock.IS_DELETE = false; _stock.IS_NEGATIVE_STOCK_MESSAGE = _StocktransferModel.IS_NEGATIVE_STOCK_MESSAGE; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetRecPay(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_RECEIVE_PAYMENT where a.COMPANY_ID == id && a.IS_DELETE == false select new RevPayModel { BUSINESS_LOCATION = a.BUSINESS_LOCATION, BUSINESS_LOCATION_ID = a.BUSINESS_LOCATION_ID, TOTAL_SELECTED_PAY_AMT = a.TOTAL_SELECTED_PAY_AMT, TOTAL_REC_AMT = a.TOTAL_REC_AMT, COMPANY_ID = a.COMPANY_ID, CURRENT_PAY_AMT = a.CURRENT_PAY_AMT, CUSTOMER = a.CUSTOMER, CUSTOMER_CONTACT_NO = a.CUSTOMER_CONTACT_NO, CUSTOMER_EMAIL = a.CUSTOMER_EMAIL, CUSTOMER_ID = a.CUSTOMER_ID, DATE = a.DATE, IS_EMAIL_SEND = a.IS_EMAIL_SEND, OTHER_PAY_AMT = a.OTHER_PAY_AMT, PENDING_AMT = a.PENDING_AMT, RECEIVE_PAY_NO = a.RECEIVE_PAY_NO, RECEIVE_PAYMENT_ID = a.RECEIVE_PAYMENT_ID, RETURNABLE_AMT = a.RETURNABLE_AMT, IS_DELETE = a.IS_DELETE, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetBank(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_BANK where a.COMPANY_ID == id && a.IS_DELETED == false select new BankModel { ADDRESS_1 = a.ADDRESS_1, ADDRESS_2 = a.ADDRESS_2, BANK_CODE = a.BANK_CODE, BANK_ID = a.BANK_ID, BANK_NAME = a.BANK_NAME, CITY = a.CITY, COMPANY_ID = a.COMPANY_ID, COUNTRY = a.COUNTRY, EMAIL = a.EMAIL, FAX_NUMBER = a.FAX_NUMBER, IFSC_CODE = a.IFSC_CODE, IS_DELETED = a.IS_DELETED, MOBILE_NUMBER = a.MOBILE_NUMBER, PHONE_NUMBER = a.PHONE_NUMBER, PIN_CODE = a.PIN_CODE, STATE = a.STATE, WEBSITE = a.WEBSITE, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetAccessRights(long EId) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.MODULE_RIGHTS where a.User_Id == EId select new UserAccessModel { ACTION_CREATE = a.ACTION_CREATE, ACTION_DELETE = a.ACTION_DELETE, ACTION_VIEW = a.ACTION_VIEW, APPROVE = a.APPROVE, Company_Id = a.Company_Id, EDIT = a.EDIT, EXPT_TO_EXCEL = a.EXPT_TO_EXCEL, ID = a.ID, IMORT_TO_EXCEL = a.IMORT_TO_EXCEL, MAILBACK = a.MAILBACK, MESSAGE = a.MESSAGE, MODULE_ID = a.MODULE_ID, MODULE_NAME = a.MODULE_NAME, NOTIFICATION = a.NOTIFICATION, User_Id = a.User_Id, VERIFICATION = a.VERIFICATION, ROLE_ID = (long)a.ROLE_ID, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage UpdateRecPay(RevPayModel _recPay) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var Rpay = (from a in db.TBL_RECEIVE_PAYMENT where a.RECEIVE_PAYMENT_ID == _recPay.RECEIVE_PAYMENT_ID select a).FirstOrDefault(); Rpay.BUSINESS_LOCATION = _recPay.BUSINESS_LOCATION; Rpay.BUSINESS_LOCATION_ID = 1; Rpay.CURRENT_PAY_AMT = _recPay.CURRENT_PAY_AMT; Rpay.CUSTOMER = _recPay.CUSTOMER; Rpay.CUSTOMER_CONTACT_NO = _recPay.CUSTOMER_CONTACT_NO; Rpay.CUSTOMER_EMAIL = _recPay.CUSTOMER_EMAIL; Rpay.CUSTOMER_ID = 1; Rpay.DATE = DateTime.Now; Rpay.IS_EMAIL_SEND = _recPay.IS_EMAIL_SEND; Rpay.OTHER_PAY_AMT = _recPay.OTHER_PAY_AMT; Rpay.PENDING_AMT = _recPay.PENDING_AMT; Rpay.RECEIVE_PAY_NO = _recPay.RECEIVE_PAY_NO; Rpay.RETURNABLE_AMT = _recPay.RETURNABLE_AMT; Rpay.TOTAL_REC_AMT = _recPay.TOTAL_REC_AMT; Rpay.TOTAL_SELECTED_PAY_AMT = _recPay.TOTAL_SELECTED_PAY_AMT; Rpay.COMPANY_ID = _recPay.COMPANY_ID; Rpay.IS_DELETE = false; db.TBL_RECEIVE_PAYMENT.Add(Rpay); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetAllTransferedCash(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_TRANSFER_CASH //join b in db.TBL_BUSINESS_LOCATION on a.BUSINESS_LOC equals b.BUSINESS_LOCATION_ID where a.COMPANY_ID == id && a.IS_DELETE == false select new CashRegModel { BUSINESS_LOCATION = a.BUSINESS_LOC, TRANSFER_ID = a.TRANSFER_ID, TRANSFER_CODE = a.CASH_TRANSFER_NUMBER, FROM_TRAN_CASH_REGISTER = a.FROM_CASH_REGISTER, TO_TRAN_CASH_REGISTER = a.TO_CASH_REGISTER, CASH_TO_TRANSFER = a.TOTAL_TRANSFERED_AMOUNT, CASH_REG_NO = 1, IS_MAIN_CASH = false, ISADGUSTMENT = false, COMPANY_ID = a.COMPANY_ID, CASH_AMOUNT = 1, //TRANSFER_DATE = a.TRANSFER_DATE, TRANSFER_DATE = System.DateTime.Now, IS_TRANSFER_CASH_REGISTER = a.IS_TRANSFER_CASH_REGISTER, STATUS = a.STATUS, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetTopCustomers(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str1 = (from x in (from T1 in db.TBL_INVOICE_PAY group new { T1 } by new { T1.CUSTOMER_ID } into g select new { CUSTOMER_ID = g.Key.CUSTOMER_ID, TOTAL_PURCHASE = g.Sum(b => b.T1.TOTAL_AMOUNT), NO_OF_INVOICE = g.Count() }) join CU in db.TBL_CUSTOMER on x.CUSTOMER_ID equals CU.CUSTOMER_ID select new { CUSTOMER_ID = x.CUSTOMER_ID, CUSTOMER_CODE = CU.CUSTOMER_NUMBER, CUSTOMER_NAME = CU.FIRST_NAME + " " + CU.LAST_NAME, TOTAL_NO_OF_INVOICE = x.NO_OF_INVOICE, TOTAL_PURCHASE = x.TOTAL_PURCHASE }).OrderByDescending(p => p.TOTAL_PURCHASE); return(Request.CreateResponse(HttpStatusCode.OK, str1)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetTopVendors(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str1 = (from x in (from T1 in db.TBL_PO where T1.COMPANY_ID == id group new { T1 } by new { T1.SUPPLIER_ID } into g select new { SUPPLIER_ID = g.Key.SUPPLIER_ID, TOTAL_PURCHASE = g.Sum(b => b.T1.TOTAL_AMOUNT), NO_OF_PURCHASEORDER = g.Count() }) join SU in db.TBL_SUPPLIER on x.SUPPLIER_ID equals SU.SUPPLIER_CODE select new { SUPPLIER_CODE = SU.SUPPLIER_CODE, SUPPLIER_NAME = SU.SUPPLIER_NAME, TOTAL_NO_OF_PURCHASEORDER = x.NO_OF_PURCHASEORDER, TOTAL_PURCHASE = x.TOTAL_PURCHASE }).OrderByDescending(p => p.TOTAL_PURCHASE); return(Request.CreateResponse(HttpStatusCode.OK, str1)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetEstimate(string id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str1 = (from p in db.TBL_ESTIMATE1 group p by p.ID into grps select new EstimateModel { EstimateId = grps.Key, //EstimateNo = grps.Select(x => x.ESTIMATE_NO.ToString()), //EstimateNo = grps.Key, //Item_Id = Convert.ToInt32(grps.Select( x=> x.ITEM_ID).ToString()), //ItemName = grps.Select(x => x.ITEM_NAME).ToString(), //EstimateDate = Convert.ToDateTime(grps.Select(x => x.ESTIMATE_DATE).ToString()), // Values = grps, // Datetime=grps.FirstOrDefault(x=>x.ESTIMATE_DATE), CountItem = grps.Count(), TotalPrice = grps.Sum(x => x.TOTAL), TotalTax = grps.Sum(x => x.TOTAL_WITH_TAX), //TotalTax=0, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str1)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetAllCashReg(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_NEWCASHREGISTER where a.COMPANY_ID == id && a.IS_DELETE == false select new CashRegModel { BUSINESS_LOCATION = a.BUSINESS_LOCATION, CASH_REG_NAME = a.CASH_REG_NAME, CASH_REG_NO = a.CASH_REG_NO, CASH_REG_PREFIX = a.CASH_REG_PREFIX, CASH_REGISTERID = a.CASH_REGISTERID, ISADGUSTMENT = a.IS_ADGUSTMENT, LOGIN = a.LOGIN, IS_MAIN_CASH = a.IS_MAIN_CASH, IS_TRANSFER_CASH_REGISTER = true, TRANSFER_DATE = System.DateTime.Now, CASH_TO_TRANSFER = 1, COMPANY_ID = a.COMPANY_ID, CASH_AMOUNT = a.CASH_AMOUNT, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage ReportGroupAdd(ReportGroupModel _ReportGroupModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { if (_ReportGroupModel.REPORT_GRP_ID == null || _ReportGroupModel.REPORT_GRP_ID == 0) { TBL_REPORT_GROUP _gr = new TBL_REPORT_GROUP(); _gr.DATE = DateTime.Now; _gr.DESCRIPTION = _ReportGroupModel.DESCRIPTION; _gr.GROUP_NAME = _ReportGroupModel.GROUP_NAME; //_gr.REPORT_ID = _ReportGroupModel.REPORT_ID; _gr.REPORT_ID = 4; _gr.IS_DELETE = _ReportGroupModel.IS_DELETE; _gr.COMPANY_ID = _ReportGroupModel.COMPANY_ID; _gr.CREATED_BY = _ReportGroupModel.CREATED_BY; _gr.REPORT_NAME = _ReportGroupModel.REPORT_NAME; _gr.SGROUP_CODE = _ReportGroupModel.SGROUP_CODE; db.TBL_REPORT_GROUP.Add(_gr); db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetEmailSettings(long userId) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_EMAIL_SETTINGS where a.USER_ID == userId && a.IS_DELETE == false select new EmailSettingsModel { USER_NAME = a.USER_NAME, SMTP_SERVER_PORT = a.SMTP_SERVER_PORT, SMTP_SERVER = a.SMTP_SERVER, PASSWORD = a.PASSWORD, NAME = a.NAME, IS_REQ_ENCRYPT_CONN = a.IS_REQ_ENCRYPT_CONN, IS_GMAIL = a.IS_GMAIL, EMAIL = a.EMAIL, CC = a.CC, BCC = a.BCC, ID = a.ID, MAIL_TYPE = a.MAIL_TYPE }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetLoyalty(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_LOYALTY where a.COMPANY_ID == id && a.IS_DELETE == false select new LoyaltyModel { COLLECTION = a.COLLECTION, COMPANY_ID = a.COMPANY_ID, CUSTOMERGROUP = a.CUSTOMERGROUP, FROMDATE = a.FROMDATE, IS_DELETE = a.IS_DELETE, ISACTIVE = a.ISACTIVE, ISDEFAULT = a.ISDEFAULT, LOYALTI_ID = a.LOYALTY_ID, SETTINGSNAME = a.SETTINGSNAME, TODATE = a.TODATE, WEIGHTAGE = a.WEIGHTAGE, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetCashRegWithChequeNo() { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var data = (from a in db.TBL_CASH_REG join b in db.TBL_CHEQUE on a.INVOICE_ID equals b.INVOICE_ID select new CashRegModel { CASH_REG_NO = 0, ISADGUSTMENT = false, IS_MAIN_CASH = false, IS_TRANSFER_CASH_REGISTER = false, TRANSFER_DATE = a.CASH_REG_DATE, COMPANY_ID = 1, CASH_AMOUNT = a.CASH_AMOUNT.Value, CASH_TO_TRANSFER = 0, CURRENT_CASH = a.CASH_AMOUNT.Value, CHEQUE_NO = b.CHEQUE_NO, CHEQUE_AMOUNT = b.CHEQUE_AMOUNT.Value }); return(Request.CreateResponse(HttpStatusCode.OK, data)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage LoyaltyUpdate(LoyaltyModel _LoyaltyModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { if (_LoyaltyModel.LOYALTI_ID != null || _LoyaltyModel.LOYALTI_ID != 0) { var gd = (from a in db.TBL_LOYALTY where a.LOYALTY_ID == _LoyaltyModel.LOYALTI_ID select a).FirstOrDefault(); gd.COLLECTION = _LoyaltyModel.COLLECTION; gd.COMPANY_ID = _LoyaltyModel.COMPANY_ID; gd.CUSTOMERGROUP = _LoyaltyModel.CUSTOMERGROUP; gd.FROMDATE = DateTime.Now; gd.IS_DELETE = false; gd.ISACTIVE = _LoyaltyModel.ISACTIVE; gd.ISDEFAULT = _LoyaltyModel.ISDEFAULT; gd.SETTINGSNAME = _LoyaltyModel.SETTINGSNAME; gd.TODATE = DateTime.Now; gd.WEIGHTAGE = _LoyaltyModel.WEIGHTAGE; db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage ReportGroupEdit(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_REPORT_GROUP where a.REPORT_GRP_ID == id && a.IS_DELETE == false select new ReportGroupModel { DATE = a.DATE, DESCRIPTION = a.DESCRIPTION, REPORT_GRP_ID = a.REPORT_GRP_ID, GROUP_NAME = a.GROUP_NAME, REPORT_ID = a.REPORT_ID, CREATED_BY = a.CREATED_BY, COMPANY_ID = a.COMPANY_ID, IS_DELETE = a.IS_DELETE, REPORT_NAME = a.REPORT_NAME, SGROUP_CODE = a.SGROUP_CODE, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage GetManageStock(int id) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { var str = (from a in db.TBL_GODOWN join b in db.TBL_COMPANY on a.COMPANY_ID equals b.COMAPNY_ID where b.COMAPNY_ID == id select new ManageStockModel { BUSSINESS_LOCATION = b.COMPANY_NAME, COMPANY_ID = b.COMAPNY_ID, GODOWN_NAME = a.GODOWN_NAME, GODOWN_ID = a.GODOWN_ID, IS_ACTIVE = a.IS_ACTIVE, IS_DEFAULT_GODOWN = a.IS_DEFAULT_GODOWN, DESCRIPTION = a.GOSOWN_DESCRIPTION, }).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, str)); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }
public HttpResponseMessage CreateCashReg(CashRegModel _CashRegModel) { try { bool conn = false; conn = db.Database.Exists(); if (!conn) { ConnectionTools.changeToLocalDB(db); conn = db.Database.Exists(); } if (conn) { TBL_NEWCASHREGISTER _CashReg = new TBL_NEWCASHREGISTER(); _CashReg.COMPANY_ID = _CashRegModel.COMPANY_ID; _CashReg.BUSINESS_LOCATION = _CashRegModel.BUSINESS_LOCATION; _CashReg.CASH_REG_NAME = _CashRegModel.CASH_REG_NAME; _CashReg.CASH_REG_NO = _CashRegModel.CASH_REG_NO; _CashReg.CASH_REG_PREFIX = _CashRegModel.CASH_REG_PREFIX; _CashReg.CASH_REGISTERID = _CashRegModel.CASH_REGISTERID; _CashReg.IS_ADGUSTMENT = _CashRegModel.ISADGUSTMENT; _CashReg.LOGIN = _CashRegModel.LOGIN; _CashReg.IS_MAIN_CASH = _CashRegModel.IS_MAIN_CASH; _CashReg.IS_DELETE = false; _CashReg.CASH_AMOUNT = _CashRegModel.CASH_AMOUNT; db.TBL_NEWCASHREGISTER.Add(_CashReg); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "success")); } else { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } catch (Exception ex) { throw; } finally { ConnectionTools.ChangeToRemoteDB(db); } }