コード例 #1
0
        public string Getcustomers()
        {
            PLog.Info("BEGIN::Controller > Home, Method >LoadWarehouses ");

            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();

            try
            {
                ICustomerImple oCustomerImple = new CustomerImple();
                DataTable      dt             = oCustomerImple.GetGridData(0); //0 will gets all the customers data

                Dictionary <string, object> row;
                foreach (DataRow dr in dt.Rows)
                {
                    row = new Dictionary <string, object>();
                    foreach (DataColumn col in dt.Columns)
                    {
                        row.Add(col.ColumnName, dr[col]);
                    }
                    rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > LoadWarehouses()", ex);
            }
            PLog.Info("END::Controller > Home, Method > LoadWarehouses");
            return(Newtonsoft.Json.JsonConvert.SerializeObject(rows));
        }
コード例 #2
0
        public ActionResult SaveCustomer(string Data)
        {
            PLog.Info("BEGIN::Controller > Home, Method > SaveProduct(string Data)");
            long           flg            = 0;
            ICustomerImple oCustomerImple = new CustomerImple();

            try
            {
                CustomerModel obj = JsonConvert.DeserializeObject <CustomerModel>(Data);
                flg = oCustomerImple.Save(obj);
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > SaveProduct(string Data)", ex);
            }
            PLog.Info("END::Controller > Home, Method > SaveProduct(string Data)");
            return(Content(flg.ToString()));
        }
コード例 #3
0
        public long DeleteCustomer(string ID)
        {
            PLog.Info("BEGIN::Controller > Home, Method > DeleteProduct(string ID)");
            long ret = 0;

            if (!string.IsNullOrEmpty(ID))
            {
                try
                {
                    ICustomerImple oCustomerImple = new CustomerImple();
                    ret = oCustomerImple.Delete(Convert.ToInt32(ID));
                }
                catch (Exception ex)
                {
                    PLog.Error("Error::Controller > Home, Method > DeleteProduct(string ID)", ex);
                }
            }
            PLog.Info("END::Controller > Home, Method > DeleteProduct(string ID)");
            return(ret);
        }
コード例 #4
0
        public ActionResult UpdateCustomer(string ID)
        {
            PLog.Info("BEGIN::Controller > UpdateCustomer, Method > UpdateCustomer(string ID");
            ICustomerImple oCustomerImple = new CustomerImple();
            CustomerModel  objModel       = null;

            try
            {
                if (!string.IsNullOrEmpty(ID))
                {
                    objModel = oCustomerImple.Edit(Convert.ToInt32(ID));
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > UpdateCustomer, Method > UpdateCustomer(string ID)", ex);
            }
            PLog.Info("END::Controller > UpdateCustomer, Method > UpdateCustomer(string ID)");
            return(View("AddCustomer", objModel));
        }