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("[]"); } }
protected void Button1_Click(object sender, EventArgs e) { using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase()) { DataTable dt = connFunc.ExecuteDataTable("[YYY_sp_Permission_User_LogIn]", CommandType.StoredProcedure, "@username", SqlDbType.NVarChar, u_name.Value.Replace("'", "").Trim(), "@password", SqlDbType.NVarChar, u_pass.Value.Replace("'", "").Trim() ); if (dt.Rows.Count > 0) { Comon.Global.sys_userid = Convert.ToInt32(dt.Rows[0]["ID"].ToString()); Session.SetCurrentUser(new UserLogin() { UserName = u_name.Value.Replace("'", "").Trim(), Password = u_pass.Value.Replace("'", "").Trim(), id = "12" }); Label1.Text = ""; Comon.Global.Initalize(); Response.Redirect("~/Views/Appointment/pageAppointmentInDay.aspx"); } else { Label1.Text = "Sai Username , Password"; Session.SetCurrentUser(null); } } }
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); }
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"); } }
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("[]"); } }
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"); } }
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); } }
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); } }
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("[]"); } }
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); } }
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(""); } }
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); } }
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"); } }
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); } }
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("[]"); } }
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); } }
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"); } }
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"); } }
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"); } }
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"); } }
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); } }
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(""); } }
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("[]"); } }
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); }
public static string ExcuteData(string data, string dataServiceStage) { try { DataServiceStage DataMain = JsonConvert.DeserializeObject <DataServiceStage>(data); JavaScriptSerializer json_serializer = new JavaScriptSerializer(); DataTable DataServiceStage = new DataTable(); DataServiceStage = JsonConvert.DeserializeObject <DataTable>(dataServiceStage); if (_CurrentID == null) { using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase()) { connFunc.ExecuteDataTable("YYY_sp_Service_Stage_Insert", CommandType.StoredProcedure, "@Name", SqlDbType.NVarChar, DataMain.Name.Replace("'", "").Trim(), "@Amount", SqlDbType.Decimal, DataMain.Amount, "@ServiceType", SqlDbType.Int, DataMain.ServiceType, "@Created_By", SqlDbType.Int, Comon.Global.sys_userid, "@Created", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(), "@Content", SqlDbType.Int, DataMain.Content.Replace("'", "").Trim(), "@PerConsulAmount", SqlDbType.Int, DataMain.PerConsulAmount, "@PerConsulPercent", SqlDbType.Int, DataMain.PerConsulPercent, "@PerTreatAmount", SqlDbType.Int, DataMain.PerTreatAmount, "@PerTreatPercent", SqlDbType.Int, DataMain.PerTreatPercent, "@IsPro", SqlDbType.Int, DataMain.IsPro, "@TimeToTreatment", SqlDbType.Int, DataMain.TimeToTreatment, "@table_data", SqlDbType.Structured, DataServiceStage.Rows.Count > 0 ? DataServiceStage : null ); } } else { using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase()) { connFunc.ExecuteDataTable("[YYY_sp_Service_Stage_Update]", CommandType.StoredProcedure, "@Name", SqlDbType.NVarChar, DataMain.Name.Replace("'", "").Trim(), "@Amount", SqlDbType.Decimal, DataMain.Amount, "@ServiceType", SqlDbType.Int, DataMain.ServiceType, "@Content", SqlDbType.NVarChar, DataMain.Content.Replace("'", "").Trim(), "@table_data", SqlDbType.Structured, DataServiceStage.Rows.Count > 0 ? DataServiceStage : null, "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid, "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(), "@PerConsulAmount", SqlDbType.Int, DataMain.PerConsulAmount, "@PerConsulPercent", SqlDbType.Int, DataMain.PerConsulPercent, "@PerTreatAmount", SqlDbType.Int, DataMain.PerTreatAmount, "@PerTreatPercent", SqlDbType.Int, DataMain.PerTreatPercent, "@IsPro", SqlDbType.Int, DataMain.IsPro, "@TimeToTreatment", SqlDbType.Int, DataMain.TimeToTreatment, "@currentID", SqlDbType.Int, Convert.ToInt32(_CurrentID) ); } } return("1"); } catch (Exception ex) { return("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"); } }
public static string ExcuteData(string data) { try { ServiceDetail DataMain = JsonConvert.DeserializeObject <ServiceDetail>(data); if (_CurrentID == null) { using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase()) { connFunc.ExecuteDataTable("YYY_sp_Customer_TabService_Insert", CommandType.StoredProcedure, "@Customer_ID", SqlDbType.Int, _CustomerID, "@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, "@Quantity", SqlDbType.Int, DataMain.Quantity, "@Service_ID", SqlDbType.Int, DataMain.ServiceID, "@Discount_ID", SqlDbType.Int, DataMain.Discount_ID, "@Price_Root", SqlDbType.Decimal, DataMain.Price_Root, "@Discount_Amount", SqlDbType.Decimal, DataMain.Discount_Amount, "@Discount_Percent", SqlDbType.Int, DataMain.Discount_Percent, "@Discount_Amount_Doctor", SqlDbType.Decimal, DataMain.Discount_Amount_Doctor, "@Price_Discounted", SqlDbType.Decimal, DataMain.Price_Discounted, "@Employee_ID", SqlDbType.Int, DataMain.Consult, "@AmountConsult", SqlDbType.Decimal, DataMain.ConsultAmount ); } } else { using (Models.ExecuteDataBase connFunc = new Models.ExecuteDataBase()) { connFunc.ExecuteDataTable("YYY_sp_Customer_TabService_Update", CommandType.StoredProcedure, "@Content", SqlDbType.NVarChar, DataMain.Content.Replace("'", "").Trim(), "@Modified_By", SqlDbType.Int, Comon.Global.sys_userid, "@Modified", SqlDbType.DateTime, Comon.Comon.GetDateTimeNow(), "@Service_ID", SqlDbType.Int, DataMain.ServiceID, "@Quantity", SqlDbType.Int, DataMain.Quantity, "@Price_Root", SqlDbType.Decimal, DataMain.Price_Root, "@Discount_ID", SqlDbType.Int, DataMain.Discount_ID, "@Discount_Persent", SqlDbType.Int, DataMain.Discount_Percent, "@Discount_Amount", SqlDbType.Decimal, DataMain.Discount_Amount, "@Discount_Amount_Doctor", SqlDbType.DateTime, DataMain.Discount_Amount_Doctor, "@Price_Discounted", SqlDbType.Decimal, DataMain.Price_Discounted, "@Current_ID", SqlDbType.Int, _CurrentID, "@Employee_ID", SqlDbType.Int, DataMain.Consult, "@AmountConsult", SqlDbType.Decimal, DataMain.ConsultAmount ); } } return("1"); } catch (Exception ex) { return("0"); } }
private void Loadata(int id) { DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("Name"); dt.Columns.Add("Content"); dt.Columns.Add("DateForm"); dt.Columns.Add("DateTo"); dt.Columns.Add("Amount", typeof(Decimal)); dt.Columns.Add("Percent", typeof(Int32)); dt.Columns.Add("Type"); dt.Columns.Add("Rule"); dt.Columns.Add("Left"); dt.Columns.Add("Right"); using (Models.ExecuteDataBase confunc = new Models.ExecuteDataBase()) { dt = confunc.ExecuteDataTable("[YYY_sp_Discount_LoadDetail]", CommandType.StoredProcedure, "@Current", SqlDbType.Int, Convert.ToInt32(id)); } if (dt != null) { string[] service = dt.Rows[0]["Rule"].ToString().Split('-'); _DataDiscount = JsonConvert.SerializeObject(dt); if (dt.Rows[0]["Type"].ToString() == "1") { var drrContain = from items in _Service where service.Contains(items.ID) select items; var drrNotContain = from items in _Service where !service.Contains(items.ID) select items; _DataTableServiceLeft = JsonConvert.SerializeObject(drrNotContain); _DataTableServiceRight = JsonConvert.SerializeObject(drrContain); } if (dt.Rows[0]["Type"].ToString() == "2") { var drrContain = from items in _ServiceType where service.Contains(items.ID) select items; var drrNotContain = from items in _ServiceType where !service.Contains(items.ID) select items; _DataTableServiceLeft = JsonConvert.SerializeObject(drrNotContain); _DataTableServiceRight = JsonConvert.SerializeObject(drrContain); } } else { _DataTableServiceLeft = ""; _DataTableServiceRight = ""; _DataDiscount = ""; } }
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); } }