示例#1
0
        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 Patient GetPatient(Member member)
        {
            Patient    patient    = new Patient();
            SqlCommand sqlCommand = new SqlCommand("SP_GetPatient", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@patientEmail", member.MemberEmail);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    patient.PatientId        = Convert.ToInt32(dr["PatientId"]);
                    patient.PatientEmail     = dr["PatientEmail"].ToString();
                    patient.PatientFirstName = dr["PatientFirstName"].ToString();
                    patient.PatientLastName  = dr["PatientLastName"].ToString();
                }
            }
            sqlConnection.Close();

            return(patient);
        }
示例#3
0
        public List <Polyclinic> GetPolyclinicList(int departmentId)
        {
            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlCommand sqlCommand = new SqlCommand("SP_GetPolyclinics", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@DepartmentId", departmentId);

            List <Polyclinic> polyclinics = new List <Polyclinic>();

            polyclinics.Add(null);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            Polyclinic polyclinic = new Polyclinic();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    polyclinic.PolyclinicId   = Convert.ToInt32(dr["PolyclinicId"].ToString());
                    polyclinic.PolyclinicName = dr["PolyclinicName"].ToString();
                    polyclinic.DepartmentId   = Convert.ToInt32(dr["DepartmanId"].ToString());
                    polyclinics.Add(polyclinic);
                }
            }
            sqlConnection.Close();

            return(polyclinics);
        }
示例#4
0
        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);
            }
        }
示例#5
0
        public Member GetMember(string email)
        {
            Member     member     = new Member();
            SqlCommand sqlCommand = new SqlCommand("SP_GetMember", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@Email", email);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    member.MemberEmail    = dr["MemberEmail"].ToString();
                    member.MemberPassword = dr["MemberPassword"].ToString();
                    member.RoleId         = Convert.ToInt32(dr["RoleId"].ToString());
                }
            }
            sqlConnection.Close();

            return(member);
        }
示例#6
0
        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);
            }
        }
示例#7
0
        public List <Session> GetDoctorAppointmentTimeId(int DoctorId, DateTime SessionDate)
        {
            List <Session> SessionsList = new List <Session>();
            SqlCommand     sqlCommand   = new SqlCommand("SP_GetRendezvousTimeId", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@DoctorId", DoctorId);
            sqlCommand.Parameters.AddWithValue("@SessionDate", SessionDate);

            ConnectionTools.DatabaseOpen(sqlConnection);
            SqlDataReader dr = sqlCommand.ExecuteReader();


            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Session session = new Session
                    {
                        SessionId        = Convert.ToInt32(dr["SessionId"].ToString()),
                        RendezvousTimeId = Convert.ToInt32(dr["RendezvousTimeId"].ToString()),
                        DoctorId         = Convert.ToInt32(dr["DoctorId"].ToString()),
                        SessionDate      = Convert.ToDateTime(dr["SessionDate"].ToString()),
                    };

                    SessionsList.Add(session);
                }
            }
            sqlConnection.Close();

            return(SessionsList);
        }
示例#8
0
        public Doctor GetDoctor(Member member)
        {
            Doctor     doctor     = new Doctor();
            SqlCommand sqlCommand = new SqlCommand("SP_GetDoctor", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@memberEmail", member.MemberEmail);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    doctor.DoctorId        = Convert.ToInt32(dr["DoctorId"].ToString());
                    doctor.DoctorEmail     = dr["DoctorEmail"].ToString();
                    doctor.DoctorFirstName = dr["DoctorFirstName"].ToString();
                    doctor.DoctortLastName = dr["DoctorLastName"].ToString();
                }
            }
            sqlConnection.Close();

            return(doctor);
        }
示例#9
0
        public int GetSessionId(int rendezvousTimeId, int doctorId, DateTime date)
        {
            int sessionId = 0;


            SqlCommand sqlCommand = new SqlCommand("SP_GetSessionId", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@rendezvousTimeId", rendezvousTimeId);
            sqlCommand.Parameters.AddWithValue("@doctorId", doctorId);
            sqlCommand.Parameters.AddWithValue("@sessionDate", date);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    sessionId = Convert.ToInt32(dr["SessionId"]);
                }
            }
            sqlConnection.Close();
            return(sessionId);
        }
示例#10
0
        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);
            }
        }
示例#11
0
        public Patient GetPatient(int rendezvousTimeId, int doctorId, DateTime date)
        {
            Patient    patient    = new Patient();
            SqlCommand sqlCommand = new SqlCommand("SP_GetRendezvousPatient", sqlConnection);

            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue("@rendezvousTimeId", rendezvousTimeId);
            sqlCommand.Parameters.AddWithValue("@doctorId", doctorId);
            sqlCommand.Parameters.AddWithValue("@sessionDate", date);

            ConnectionTools.DatabaseOpen(sqlConnection);

            SqlDataReader dr = sqlCommand.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    patient.PatientId        = Convert.ToInt32(dr["PatientId"].ToString());
                    patient.PatientEmail     = dr["PatientEmail"].ToString();
                    patient.PatientFirstName = dr["PatientFirstName"].ToString();
                    patient.PatientLastName  = dr["PatientLastName"].ToString();
                }
            }
            sqlConnection.Close();

            return(patient);
        }
示例#12
0
 public Printer(string dbPath)
 {
     if (File.Exists(dbPath) && dbPath.EndsWith(".db"))
     {
         string newConnectionString = ConnectionTools.ModifyDatabaseConnectionString(connectionStringName, dataSource: dbPath);
         string oldConnectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
         if (oldConnectionString == newConnectionString)
         {
             return;
         }
         ConnectionTools.ChangeConnectionString(newConnectionString, connectionStringName);
         using (IADbContext dbContext = new IADbContext())
         {
             if (!dbContext.Database.Exists())
             {
                 ConnectionTools.ChangeConnectionString(oldConnectionString, connectionStringName);
                 throw new FileNotFoundException();
             }
         }
     }
     else
     {
         throw new FileNotFoundException();
     }
 }
示例#13
0
        public UMSContext GetConnection(string databaseId)
        {
            //HttpClient client = new HttpClient();
            //client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);

            //HttpResponseMessage response = client.GetAsync(ConfigurationManager.AppSettings["UMS_URL"] + "/api/User/GetUserDetailsByID?userId=" + userId).Result;
            //if (response.IsSuccessStatusCode)
            //{
            //    var responseResult = response.Content.ReadAsStringAsync().Result;
            //    if (responseResult != "\"Content not found id = " + userId + "\"" && responseResult != "Content not found id = " + userId)
            //    {
            //        return true;
            //    }
            //}
            //throw new Exception("Invalid userId");

            var db = (from c in _masterDbContext.Clients
                      where c.DBName == databaseId
                      select new DBCredentials
            {
                ClientID = c.ClientID,
                DBName = c.DBName,
                DBPassword = c.DBPassword,
                DBServer = c.DBServer,
                DBUserId = c.DBUserId
            }).FirstOrDefault();

            if (db != null)
            {
                _clientDbContext = new UMSContext(ConnectionTools.GetClientConnection(db));
            }
            return(_clientDbContext);
        }
示例#14
0
        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);
            }
        }
示例#15
0
        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);
            }
        }
示例#16
0
        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);
            }
        }
示例#17
0
    public override IEnumerable <Graphs.Edge> GetOutputEdges()
    {
        List <Graphs.Edge> ret = new List <Graphs.Edge>();
        List <Graphs.Edge> tmp = new List <Graphs.Edge>();

        ConnectionTools.ListInputsOutputs(blocks, tmp, ret);
        return(ret);
    }
 public PatientManagement()
 {
     sqlConnection = ConnectionTools.Connection(sqlConnection);
     //if (sqlConnection == null)
     //{
     //    sqlConnection = new SqlConnection(ConnectionTools.ConnectionString);
     //}
 }
示例#19
0
        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);
            }
        }
示例#20
0
        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);
            }
        }
示例#21
0
        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);
            }
        }
示例#22
0
        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);
            }
        }
示例#23
0
 public BaseRepository()
 {
     if (Convert.ToBoolean(ConfigurationManager.AppSettings["IsNon_PCRDB"]) == true)
     {
         _masterDbContext = new UMSContext(ConnectionTools.GetMasterConnection());
     }
     else
     {
         _masterDbContext = new UMSContext(ConnectionTools.GetMasterDbConnection());
     }
 }
示例#24
0
        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);
            }
        }
示例#25
0
        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);
            }
        }
示例#26
0
        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);
            }
        }
示例#27
0
        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);
            }
        }
示例#28
0
        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);
            }
        }
示例#29
0
        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);
            }
        }
示例#30
0
        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);
            }
        }