Beispiel #1
0
 public static string ExcuteData(string data)
 {
     try
     {
         TakeCareDetail DataMain = JsonConvert.DeserializeObject <TakeCareDetail>(data);
         if (_CustomerID != null)
         {
             using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
             {
                 connFunc.ExecuteDataTable("YYY_sp_Customer_TakeCare_Insert", CommandType.StoredProcedure,
                                           "@TakeCare1", SqlDbType.DateTime, (DataMain.TakeCare1 != "") ? Convert.ToDateTime(DataMain.TakeCare1).ToString("yyyy-MM-dd HH:mm:ss") : null,
                                           "@TakeCare2", SqlDbType.DateTime, (DataMain.TakeCare2 != "") ? Convert.ToDateTime(DataMain.TakeCare2).ToString("yyyy-MM-dd HH:mm:ss") : null,
                                           "@TakeCare3", SqlDbType.DateTime, (DataMain.TakeCare3 != "") ? Convert.ToDateTime(DataMain.TakeCare3).ToString("yyyy-MM-dd HH:mm:ss") : null,
                                           "@TakeCare4", SqlDbType.DateTime, (DataMain.TakeCare4 != "") ? Convert.ToDateTime(DataMain.TakeCare4).ToString("yyyy-MM-dd HH:mm:ss") : null,
                                           "@Content", SqlDbType.NVarChar, DataMain.Content.Replace("'", "").Trim(),
                                           "@Branch_ID", SqlDbType.Int, Comon.Global.sys_branchID,
                                           "@Created_By", SqlDbType.Int, Comon.Global.sys_userid,
                                           "@Customer_ID", SqlDbType.Int, _CustomerID);
             }
         }
         return("1");
     }
     catch (Exception ex)
     {
         return("0");
     }
 }
Beispiel #2
0
 public string LoadDataCustomer()
 {
     try
     {
         DataTable dt         = new DataTable();
         int       CustomerID = 0;
         if (HttpContext.Session.GetInt32(Comon.GlobalClient.CustomerID) == null)
         {
             CustomerID = 0;
         }
         else
         {
             CustomerID = (int)HttpContext.Session.GetInt32(Comon.GlobalClient.CustomerID);
         }
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             dt = confunc.ExecuteDataTable("[YYY_sp_Client_Customer_LoadDetail]", CommandType.StoredProcedure
                                           , "@CusID", SqlDbType.Int, CustomerID);
         }
         return(dt != null?JsonConvert.SerializeObject(dt) : "[]");
     }
     catch (Exception ex)
     {
         return("0");
     }
 }
Beispiel #3
0
        private void Loadata(int CustomerID)
        {
            defaultAvatar = Comon.Global.sys_DefaultAvatar;
            DataSet ds = new DataSet();

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                ds = confunc.ExecuteDataSet("[YYY_sp_Customer_LoadInfo]", CommandType.StoredProcedure,
                                            "@CurrentID", SqlDbType.Int, Convert.ToInt32(CustomerID == 0 ? 0 : CustomerID));
            }
            if (ds != null)
            {
                CustName        = ds.Tables["Table"].Rows[0]["Name"].ToString();
                CustCode        = ds.Tables["Table"].Rows[0]["Cust_Code"].ToString();
                Phone           = ds.Tables["Table"].Rows[0]["Phone1"].ToString();
                Avatar          = ds.Tables["Table"].Rows[0]["Avatar"].ToString();
                facebookurl     = ds.Tables["Table"].Rows[0]["facebookurl"].ToString();
                instgramurl     = ds.Tables["Table"].Rows[0]["instgramurl"].ToString();
                totalmoneyRaise = ds.Tables["Table"].Rows[0]["TOTALPRICE"].ToString();
                totalmoneyPaid  = ds.Tables["Table"].Rows[0]["TOTALPAID"].ToString();
                totalmoneyLeft  = ds.Tables["Table"].Rows[0]["Rest"].ToString();
            }
            else
            {
                CustName        = "";
                CustCode        = "";
                Phone           = ""; Avatar = ""; instgramurl = ""; facebookurl = "";
                totalmoneyRaise = ""; totalmoneyPaid = ""; totalmoneyLeft = "";
            }
        }
Beispiel #4
0
 public static string ChangeStatus(string data)
 {
     try
     {
         ChangeStatus DataMain = JsonConvert.DeserializeObject <ChangeStatus>(data);
         if (DataMain.id != 0)
         {
             using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
             {
                 connFunc.ExecuteDataTable("YYY_sp_Customer_Appointment_ChangeStatus", CommandType.StoredProcedure,
                                           "@Status", SqlDbType.Int, DataMain.status,
                                           "@App_ID", SqlDbType.Int, DataMain.id,
                                           "@Employee_ID", SqlDbType.NVarChar, Comon.Global.sys_employeeid,
                                           "@Branch_ID", SqlDbType.Int, Comon.Global.sys_branchID,
                                           "@Created", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                           "@Created_By", SqlDbType.Int, Comon.Global.sys_userid
                                           );
             }
         }
         return("1");
     }
     catch (Exception ex)
     {
         return("0");
     }
 }
Beispiel #5
0
        public static string LoadDataSpurce(string dateFrom, string dateTo, string branchID)
        {
            DataTable dt = new DataTable();

            //dt.Columns.Add("SourceName");
            //dt.Columns.Add("Amount");
            //dt.Columns.Add("NewCustomer");
            //DataRow dr = dt.NewRow();
            //dr[0] = "06-2019"; dr[1] = "4000000"; dr[2] = "06-2019";
            //DataRow dr1 = dt.NewRow();
            //dr1[0] = "07-2019"; dr1[1] = "7000000"; dr1[2] = "07-2019";
            //dt.Rows.Add(dr);dt.Rows.Add(dr1);
            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                dt = confunc.ExecuteDataTable("[YYY_sp_Report_CustomerSource]", CommandType.StoredProcedure
                                              , "@dateFrom", SqlDbType.DateTime, Convert.ToDateTime(dateFrom)
                                              , "@dateTo", SqlDbType.DateTime, Convert.ToDateTime(dateTo)
                                              , "@branchID", SqlDbType.Int, Convert.ToInt32(branchID));
            }
            if (dt != null)
            {
                return(JsonConvert.SerializeObject(dt));
            }
            else
            {
                return("");
            }
        }
Beispiel #6
0
 public DataTable LoadPara(string paraTypeName)
 {
     try
     {
         if (_conn.State == ConnectionState.Closed)
         {
             _conn.Open();
         }
         DataTable table = new DataTable("myTable");
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             table = confunc.ExecuteDataTable("YYY_sp_LoadCombo_Para", CommandType.StoredProcedure,
                                              "@paraTypeName", SqlDbType.NVarChar, paraTypeName.Trim());
         }
         if (_conn.State == ConnectionState.Open)
         {
             _conn.Close();
         }
         return(table);
     }
     catch
     {
         return(null);
     }
 }
Beispiel #7
0
 public string ExecuteCustomer(string data)
 {
     try
     {
         DataTable          dt         = new DataTable();
         DataCustomerChoose dataDetail = JsonConvert.DeserializeObject <DataCustomerChoose>(data);
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             dt = confunc.ExecuteDataTable("[YYY_sp_Client_Customer_LoadList]", CommandType.StoredProcedure
                                           , "@UserName", SqlDbType.NVarChar, dataDetail.Username
                                           , "@Email", SqlDbType.NVarChar, dataDetail.Email);
             if (dt.Rows.Count == 0)
             {
                 dt = confunc.ExecuteDataTable("[YYY_sp_Client_Customer_Insert]", CommandType.StoredProcedure
                                               , "@UserName", SqlDbType.NVarChar, dataDetail.Username
                                               , "@Name", SqlDbType.NVarChar, dataDetail.Name
                                               , "@LastName", SqlDbType.NVarChar, dataDetail.LastName
                                               , "@Email", SqlDbType.NVarChar, dataDetail.Email
                                               , "@Password", SqlDbType.NVarChar, dataDetail.Password
                                               );
                 return("Đăng kí thành công");
             }
             else
             {
                 return("Tên Tài Khoản , Email đã được sử dụng");
             }
         }
     }
     catch (Exception ex)
     {
         return("[]");
     }
 }
Beispiel #8
0
        public static string LoadData(string dateFrom, string dateTo, string branchID)
        {
            //Ke toan   STT,ReceiptName,Amount,Date,CreatedName
            //import  STT,Date,CreatedName,Amount
            //payment  STT,CustomerName,Date,Amount,CreatedName,SourceName
            // Total ketoan, toal import, toal payment, totalmain
            DataSet ds = new DataSet();

            //DataTable dt = new DataTable();
            //dt.Columns.Add("Month"); dt.Columns.Add("Amount"); dt.Columns.Add("Target"); dt.Columns.Add("UpDown");
            //DataRow dr = dt.NewRow();
            //dr[0] = "06-2019"; dr[1] = "4000000"; dr[2] = "06-2019"; dr[3] = "<a class='ui blue mini basic label'>Up</a>";
            //DataRow dr1 = dt.NewRow();
            //dr1[0] = "07-2019"; dr1[1] = "7000000"; dr1[2] = "07-2019"; dr1[3] = "<a class='ui red mini basic label'>Down</a>";
            //dt.Rows.Add(dr); dt.Rows.Add(dr1);
            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                ds = confunc.ExecuteDataSet("[YYY_sp_Report_Overview]", CommandType.StoredProcedure,
                                            "@dateFrom", SqlDbType.DateTime, Convert.ToDateTime(dateFrom)
                                            , "@dateTo", SqlDbType.DateTime, Convert.ToDateTime(dateTo)
                                            , "@branchID", SqlDbType.Int, Convert.ToInt32(branchID));
            }
            if (ds != null)
            {
                return(JsonConvert.SerializeObject(ds, Formatting.Indented));
            }
            else
            {
                return("");
            }
        }
Beispiel #9
0
        public string RevenuePayment(string dateFrom, string dateTo)
        {
            try
            {
                DataTable dt = new DataTable();

                using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
                {
                    dt = confunc.ExecuteDataTable("[YYY_sp_Report_Revenue]", CommandType.StoredProcedure,
                                                  "@datefrom", SqlDbType.DateTime, Convert.ToDateTime(dateFrom)
                                                  , "@dateto", SqlDbType.DateTime, Convert.ToDateTime(dateTo));
                }
                if (dt != null)
                {
                    return(JsonConvert.SerializeObject(dt));
                }
                else
                {
                    return("[]");
                }
            }
            catch (Exception ex)
            {
                return("[]");
            }
        }
Beispiel #10
0
        public int DetectAuthorisedClient(string user, string pass)
        {
            try
            {
                using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
                {
                    DataTable dt = connFunc.ExecuteDataTable("[YYY_sp_Permission_UserClient_LogIn]",
                                                             CommandType.StoredProcedure,
                                                             "@username", SqlDbType.NVarChar, user.Replace("'", "").Trim(),
                                                             "@password", SqlDbType.NVarChar, pass.Replace("'", "").Trim()
                                                             );

                    if (dt.Rows.Count > 0)
                    {
                        sys_customerid = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                        sys_Email      = dt.Rows[0]["Email"].ToString();
                        return(sys_customerid);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Beispiel #11
0
        private void InitializeCombo()
        {
            _DataComboStatus = "";
            _DataComboSource = "";

            DataTable dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("Name");
            DataRow dr  = dt.NewRow(); dr[0] = 0; dr[1] = "All";
            DataRow dr1 = dt.NewRow(); dr1[0] = 1; dr1[1] = "Chưa Xử Lý";
            DataRow dr2 = dt.NewRow(); dr2[0] = 2; dr2[1] = "Đã Xử Lý";

            dt.Rows.Add(dr); dt.Rows.Add(dr1); dt.Rows.Add(dr2);
            DataTable dt1 = new DataTable();

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                dt1 = confunc.LoadPara("SourceCustomer");
                DataRow dr3 = dt1.NewRow();
                dr3[0] = 0; dr3[1] = "All";
                dt1.Rows.InsertAt(dr3, 0);
            }


            _DataComboStatus = JsonConvert.SerializeObject(dt);
            _DataComboSource = JsonConvert.SerializeObject(dt1);
        }
Beispiel #12
0
        public int DetectAuthorised(string user, string pass)
        {
            try
            {
                using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
                {
                    DataTable dt = connFunc.ExecuteDataTable("[YYY_sp_Permission_User_LogIn]",
                                                             CommandType.StoredProcedure,
                                                             "@username", SqlDbType.NVarChar, user.Replace("'", "").Trim(),
                                                             "@password", SqlDbType.NVarChar, pass.Replace("'", "").Trim()
                                                             );

                    if (dt.Rows.Count > 0)
                    {
                        sys_userid     = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                        sys_username   = dt.Rows[0]["username"].ToString();
                        sys_userAvatar = dt.Rows[0]["Avatar"].ToString();
                        //sys_RoleServerID = dt.Rows[0]["InheritanceServer"].ToString();
                        //DetectUserInfo(sys_userid);
                        return(sys_userid);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public static string LoadTicketList(string dateFrom, string dateTo, string sourceID)
        {
            DataTable dt = new DataTable();

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                dt = confunc.ExecuteDataTable("[YYY_sp_Ticket_TicketRecoverList_Load]", CommandType.StoredProcedure,
                                              "@UserID", SqlDbType.Int, Comon.Global.sys_userid
                                              , "@dateFrom", SqlDbType.DateTime, Convert.ToDateTime(dateFrom)
                                              , "@dateTo", SqlDbType.DateTime, Convert.ToDateTime(dateTo));
            }
            if (dt != null)
            {
                int source = Convert.ToInt32(sourceID);
                try
                {
                    if (source != 0)
                    {
                        dt = dt.Select("SourceID=" + source.ToString() + "").CopyToDataTable();
                    }
                    return(JsonConvert.SerializeObject(dt));
                }
                catch (Exception) // No datarow
                {
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
Beispiel #14
0
 DataTable CheckAge(int ScheduleID)
 {
     try
     {
         DataTable dt = new DataTable();
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             dt = confunc.ExecuteDataTable("[YYY_sp_CheckAges]", CommandType.StoredProcedure,
                                           "@ScheduleID", SqlDbType.Int, ScheduleID
                                           , "@CurentID", SqlDbType.Int, HttpContext.Session.GetInt32(Comon.GlobalClient.CustomerID));
         }
         if (dt != null)
         {
             return(dt);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Beispiel #15
0
        public string LoadDataComment(int MovieID)
        {
            try
            {
                DataTable ds = new DataTable();

                using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
                {
                    ds = confunc.ExecuteDataTable("[YYY_sp_Rating_LoadList]", CommandType.StoredProcedure
                                                  , "@MovieID", SqlDbType.Int, MovieID);
                }
                if (ds != null)
                {
                    return(JsonConvert.SerializeObject(ds));
                }
                else
                {
                    return("[]");
                }
            }
            catch (Exception ex)
            {
                return("[]");
            }
        }
Beispiel #16
0
 public static string ExcuteOption(string data)
 {
     try
     {
         Option DataMain = JsonConvert.DeserializeObject <Option>(data);
         if (DataMain.ID.ToString() != "0")
         {
             using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
             {
                 connFunc.ExecuteDataTable("[YYY_sp_Option_Update]", CommandType.StoredProcedure,
                                           "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid,
                                           "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                           "@CurrentID", SqlDbType.Int, DataMain.ID,
                                           "@Value ", SqlDbType.NVarChar, DataMain.Value
                                           );
             }
         }
         else
         {
         }
         return("1");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         return("0");
     }
 }
Beispiel #17
0
 public string ExecuteRating(string data)
 {
     try
     {
         DataTable  ds         = new DataTable();;
         DataRating dataDetail = JsonConvert.DeserializeObject <DataRating>(data);
         if (HttpContext.Session.GetInt32(Comon.GlobalClient.CustomerID) == null)
         {
             return("0");
         }
         int CustomerID = (int)HttpContext.Session.GetInt32(Comon.GlobalClient.CustomerID);
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             ds = confunc.ExecuteDataTable("[YYY_sp_Rating_Insert]", CommandType.StoredProcedure
                                           , "@MovieID", SqlDbType.Int, dataDetail.MovieID
                                           , "@Note", SqlDbType.NVarChar, dataDetail.NoteRating
                                           , "@Rating", SqlDbType.Decimal, dataDetail.RatingMoive
                                           , "@CusID", SqlDbType.Int, CustomerID);
         }
         return(ds.Rows[0][0].ToString());
     }
     catch (Exception ex)
     {
         return("[]");
     }
 }
Beispiel #18
0
 public static string ExcuteCompany(string data)
 {
     try
     {
         Company DataMain = JsonConvert.DeserializeObject <Company>(data);
         if (_CompanyID.ToString() != "0")
         {
             using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
             {
                 connFunc.ExecuteDataTable("[YYY_sp_Company_Update]", CommandType.StoredProcedure,
                                           "@Image ", SqlDbType.NVarChar, DataMain.Avatar.Replace("'", "").Trim(),
                                           "@Name ", SqlDbType.NVarChar, DataMain.Name.Replace("'", "").Trim(),
                                           "@Phone ", SqlDbType.NVarChar, DataMain.Hotline.Replace("'", "").Trim(),
                                           "@Address ", SqlDbType.NVarChar, DataMain.Address.Replace("'", "").Trim(),
                                           "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid,
                                           "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                           "@CurrentID", SqlDbType.Int, _CompanyID
                                           );
             }
         }
         else
         {
         }
         return("1");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
         return("0");
     }
 }
Beispiel #19
0
 public DataTable LoadEmployee(string GroupName, int Branch_ID)
 {
     try
     {
         if (_conn.State == ConnectionState.Closed)
         {
             _conn.Open();
         }
         DataTable table = new DataTable("myTable");
         using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
         {
             table = confunc.ExecuteDataTable("YYY_sp_LoadCombo_Employee", CommandType.StoredProcedure,
                                              "@GroupName", SqlDbType.NVarChar, GroupName.Trim(),
                                              "@Branch_ID", SqlDbType.Int, Branch_ID);
         }
         if (_conn.State == ConnectionState.Open)
         {
             _conn.Close();
         }
         return(table);
     }
     catch
     {
         return(null);
     }
 }
Beispiel #20
0
        public static string ExcuteBranch(string data)
        {
            try
            {
                Branch DataMain = JsonConvert.DeserializeObject <Branch>(data);
                if (_Branch_ID.ToString() != "0")
                {
                    using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
                    {
                        connFunc.ExecuteDataTable("[YYY_sp_Branch_Update]", CommandType.StoredProcedure,
                                                  "@BranchCode", SqlDbType.NVarChar, DataMain.BranchCode.Replace("'", "").Trim(),
                                                  "@Name ", SqlDbType.NVarChar, DataMain.Name.Replace("'", "").Trim(),
                                                  "@ShortName ", SqlDbType.NVarChar, DataMain.BranchCode.Replace("'", "").Trim(),
                                                  "@Target_Amount ", SqlDbType.Int, DataMain.Target,
                                                  "@Address ", SqlDbType.NVarChar, DataMain.Address,
                                                  "@Suggest_Location ", SqlDbType.NVarChar, DataMain.BranchAddressNote,
                                                  "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid,
                                                  "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                                  "@CurrentID", SqlDbType.Int, _Branch_ID

                                                  );
                    }
                }
                else
                {
                }
                return("1");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return("0");
            }
        }
Beispiel #21
0
 private void LoadComboDataWare()
 {
     using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
     {
         DataTable dt = new DataTable();
         dt        = confunc.ExecuteDataTable("YYY_sp_Product_WareHouse_LoadList", CommandType.StoredProcedure);
         _DataWare = JsonConvert.SerializeObject(dt);
     }
     using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
     {
         DataTable dt = new DataTable();
         dt.Columns.Add("ID");
         dt.Columns.Add("Name");
         DataRow dr = dt.NewRow();
         dr[0] = 1; dr[1] = "Nhập Kho";
         DataRow dr1 = dt.NewRow();
         dr1[0] = 2; dr1[1] = "Xuất Kho";
         DataRow dr2 = dt.NewRow();
         dr2[0] = 3; dr2[1] = "Tồn Kho Trước";
         DataRow dr3 = dt.NewRow();
         dr3[0] = 4; dr3[1] = "Tất Cả";
         dt.Rows.Add(dr); dt.Rows.Add(dr1); dt.Rows.Add(dr2); dt.Rows.Add(dr3);
         _DataType = JsonConvert.SerializeObject(dt);
     }
 }
 private void LoadComboMain()
 {
     _dataComboDoctor = "";
     _dataComboAssist = "";
     _dataComboStage  = "";
     //LoadDoctor
     using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
     {
         DataTable dt = new DataTable();
         dt = confunc.LoadEmployee("Doctor", 0);
         _dataComboDoctor = JsonConvert.SerializeObject(dt, Formatting.Indented);
     }
     using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
     {
         DataTable dt = new DataTable();
         dt = confunc.LoadEmployee("Assistant", 0);
         _dataComboAssist = JsonConvert.SerializeObject(dt, Formatting.Indented);
     }
     using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
     {
         DataTable dt = new DataTable();
         dt = confunc.ExecuteDataTable("YYY_sp_Customer_Treatment_LoadComboService", CommandType.StoredProcedure,
                                       "@Customer_ID", SqlDbType.Int, _CustomerID);
         _dataComboService = JsonConvert.SerializeObject(dt, Formatting.Indented);
     }
 }
Beispiel #23
0
 public static string ExcuteData(string data, string sourceID, string filename)
 {
     try
     {
         DataTable DataImportDetail = new DataTable();
         DataImportDetail = JsonConvert.DeserializeObject <DataTable>(data);
         int count = 0;
         foreach (DataRow dr in DataImportDetail.Rows)
         {
             // || dr["Phone"] != null || !regexItem.IsMatch(dr["Phone"].ToString()) || dr["Phone"].ToString().Length != 10
             count = count + 1;
             if (dr["Name"] == null || Regex.IsMatch(dr["Name"].ToString(), "^[ A-Za-z0-9]$") || dr["Phone"] == null || Regex.IsMatch(dr["Phone"].ToString(), "^[ A-Za-z0-9]$") || dr["Phone"].ToString().Length != 10)
             {
                 return(string.Format("Kiểm tra lại dữ liệu ở dòng {0} . Không thể có ký tự đặc biết và số điện thoại là 10 số", count));
             }
         }
         using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
         {
             connFunc.ExecuteDataTable("[YYY_sp_Ticket_Import_Insert]", CommandType.StoredProcedure,
                                       "@Created_By", SqlDbType.Int, Comon.Global.sys_userid,
                                       "@Source", SqlDbType.Int, Convert.ToInt32(sourceID),
                                       "@Created", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                       "@Name", SqlDbType.NVarChar, filename.Replace("'", "").Trim(),
                                       "@table_data", SqlDbType.Structured, DataImportDetail.Rows.Count > 0 ? DataImportDetail : null
                                       );
         }
         return("1");
     }
     catch (Exception ex)
     {
         return("0");
     }
 }
        public static string ExcuteData(string data, string dataDetailProduct)
        {
            try
            {
                TreatDetail DataMain = JsonConvert.DeserializeObject <TreatDetail>(data);

                if (_CurrentID == null)
                {
                    DataTable DataDetailProduct = new DataTable();
                    if (dataDetailProduct != "\"\"")
                    {
                        DataDetailProduct = JsonConvert.DeserializeObject <DataTable>(dataDetailProduct);
                    }
                    else
                    {
                        DataDetailProduct = null;
                    }
                    using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
                    {
                        connFunc.ExecuteDataTable("YYY_sp_Customer_Treatment_Insert", CommandType.StoredProcedure,
                                                  "@Customer_ID", SqlDbType.Int, _CustomerID,
                                                  "@tabID", SqlDbType.Int, DataMain.Tab_ID,
                                                  "@Content", SqlDbType.NVarChar, DataMain.Content.Replace("'", "").Trim(),
                                                  "@Created_By", SqlDbType.Int, Comon.Global.sys_userid,
                                                  "@Created", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                                  "@branch_ID", SqlDbType.Int, Comon.Global.sys_branchID,
                                                  "@BS1", SqlDbType.Int, DataMain.Doc1,
                                                  "@BS2", SqlDbType.Int, DataMain.Doc2,
                                                  "@PT1", SqlDbType.Int, DataMain.Ass1,
                                                  "@PT2", SqlDbType.Int, DataMain.Ass2,
                                                  "@StageID", SqlDbType.Int, DataMain.StageID,
                                                  "@table_data", SqlDbType.Structured, (DataDetailProduct != null && DataDetailProduct.Rows.Count > 0) ? DataDetailProduct : null,
                                                  "@TreatmentAmount", SqlDbType.Decimal, DataMain.TreatmentAmount);
                    }
                }
                else
                {
                    using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
                    {
                        connFunc.ExecuteDataTable("YYY_sp_Customer_Treatment_Update", CommandType.StoredProcedure,
                                                  "@Content", SqlDbType.NVarChar, DataMain.Content.Replace("'", "").Trim(),
                                                  "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid,
                                                  "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(),
                                                  "@BS1", SqlDbType.Int, DataMain.Doc1,
                                                  "@BS2", SqlDbType.Int, DataMain.Doc2,
                                                  "@PT1", SqlDbType.Int, DataMain.Ass1,
                                                  "@PT2", SqlDbType.Int, DataMain.Ass2,
                                                  "@CurrentID", SqlDbType.Int, _CurrentID,
                                                  "@TreatmentAmount", SqlDbType.Decimal, DataMain.TreatmentAmount

                                                  );
                    }
                }
                return("1");
            }
            catch (Exception ex)
            {
                return("0");
            }
        }
Beispiel #25
0
        public string GetMovieTicketTypeDetail(int MovieTicketTypeID)
        {
            try
            {
                DataTable dt = new DataTable();

                using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
                {
                    dt = confunc.ExecuteDataTable("[YYY_sp_MovieTicketType_LoadDetail]", CommandType.StoredProcedure,
                                                  "@CurrentID", SqlDbType.Int, MovieTicketTypeID);
                }
                if (dt != null)
                {
                    return(JsonConvert.SerializeObject(dt));
                }
                else
                {
                    return("[]");
                }
            }
            catch (Exception ex)
            {
                return("[]");
            }
        }
Beispiel #26
0
        private void InitializeComboType()
        {
            _DataComboProduct  = "";
            _DataComboSupplier = "";
            _DataComboWare     = "";
            DataTable dt = new DataTable();

            using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
            {
                dt = connFunc.ExecuteDataTable("[YYY_sp_Product_Combo_UnitReceipt]", CommandType.StoredProcedure);
            }
            DataTable dt1 = new DataTable();

            using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
            {
                dt1 = connFunc.ExecuteDataTable("YYY_sp_Product_Combo_Supplier", CommandType.StoredProcedure);
            }
            DataTable dt2 = new DataTable();

            using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
            {
                dt2 = connFunc.ExecuteDataTable("[YYY_sp_Product_Combo_Product]", CommandType.StoredProcedure);
            }
            DataTable dt3 = new DataTable();

            using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase())
            {
                dt3 = connFunc.ExecuteDataTable("[YYY_sp_Product_Combo_BranchWareHouse]", CommandType.StoredProcedure);
            }
            _DataComboProduct   = JsonConvert.SerializeObject(dt2);
            _DataComboSupplier  = JsonConvert.SerializeObject(dt1);
            _DataComboUnitCount = JsonConvert.SerializeObject(dt);
            _DataComboWare      = JsonConvert.SerializeObject(dt3);
        }
        private void InitializeService()
        {
            _Service     = new List <DiscountTable>();
            _ServiceType = new List <DiscountTable>();
            DataSet ds = new DataSet();

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                ds = confunc.ExecuteDataSet("[YYY_sp_Discount_LoadListService]", CommandType.StoredProcedure);
            }
            if (ds != null)
            {
                DataTable dtService     = ds.Tables[0];
                DataTable dtServiceType = ds.Tables[1];
                foreach (DataRow dr in dtService.Rows)
                {
                    _Service.Add(new DiscountTable(dr[0].ToString(), dr[1].ToString()));
                }
                foreach (DataRow dr in dtServiceType.Rows)
                {
                    _ServiceType.Add(new DiscountTable(dr[0].ToString(), dr[1].ToString()));
                }
            }
            else
            {
                _Service     = null;
                _ServiceType = null;
            }
        }
Beispiel #28
0
        private void Loadata(int id)
        {
            DataSet ds = new DataSet();

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                ds = confunc.ExecuteDataSet("[YYY_sp_Product_Reciept_LoadDetail]", CommandType.StoredProcedure,
                                            "@ID", SqlDbType.Int, Convert.ToInt32(id == 0 ? 0 : id));
            }
            if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
            {
                _DataProductChoosen = JsonConvert.SerializeObject(ds.Tables[1]);
            }
            else
            {
                _DataProductChoosen = null;
            }
            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                _DataInputMain = JsonConvert.SerializeObject(ds.Tables[0]);
            }
            else
            {
                _DataInputMain = "";
            }
        }
Beispiel #29
0
        public static string CheckexistUser(string EmpName)

        {
            EmpName = EmpName.Trim();
            string username = "";

            string[] user = Comon.Comon.ConvertToUnsign(EmpName).Split(' ');
            if (user != null && user.Length > 0)
            {
                username = user[user.Length - 1].ToString().Trim() == user[0].ToString().Trim() ? user[user.Length - 1].ToString().Trim() : user[user.Length - 1].ToString().Trim() + "." + user[0].ToString().Trim();
            }

            using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
            {
                var dt = confunc.ExecuteDataTable("YYY_sp_User_CheckUserName", CommandType.StoredProcedure, "@username", SqlDbType.NVarChar, username);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (Convert.ToUInt32(dt.Rows[0][0].ToString()) != 0)
                    {
                        username = username + "." + (Convert.ToUInt32(dt.Rows[0][0].ToString())).ToString();
                    }
                }
            }

            return(username);
        }
Beispiel #30
0
 DataTable LoadDetail(int UserID)
 {
     try
     {
         if (UserID == 0)
         {
             return(null);
         }
         else
         {
             DataTable dt = new DataTable();
             using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase())
             {
                 dt = confunc.ExecuteDataTable("[YYY_sp_Employee_LoadDetail]", CommandType.StoredProcedure,
                                               "@CurrentID", SqlDbType.Int, UserID);
             }
             if (dt != null)
             {
                 return(dt);
             }
             else
             {
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }