//function overload public List <UserInfo> GetUserList() { SqlDbAccess dbAccess = new SqlDbAccess(); SqlCommand cmd = dbAccess.GetCommand("SELECT * FROM UserInfo"); //SqlParameter param1 = new SqlParameter("@title", SqlDbType.VarChar, 5); //param1.Value = str1; //SqlParameter param2 = new SqlParameter("@title1", SqlDbType.VarChar, 20); //param2.Value = str2; //cmd.Parameters.Add(param1); //cmd.Parameters.Add(param2); cmd.Connection.Open(); int val = cmd.ExecuteNonQuery(); cmd.Connection.Close(); List <UserInfo> userList = GetData(cmd); return(userList); }
private string execute(pgmmas p) { SqlDbAccess dbAccess = new SqlDbAccess(PKDBHelper.ConnectString); string jsonset = string.Empty; if (("{SLT}").IndexOf("{" + p.rmode + "}") >= 0) { string query = @"SYS_PGMMAS_Q1"; SqlParamCollection parameters = new SqlParamCollection(); PKDBHelper.SqlAddParam(parameters, "@INFDS", SqlDbType.VarChar, 100, p.infds); PKDBHelper.SqlAddParam(parameters, "@RTNCD", SqlDbType.VarChar, 100, p.rtncd); PKDBHelper.SqlAddParam(parameters, "@RMODE", SqlDbType.VarChar, 20, p.rmode); PKDBHelper.SqlAddParam(parameters, "@USRID", SqlDbType.VarChar, 10, p.usrid); PKDBHelper.SqlAddParam(parameters, "@USRTY", SqlDbType.VarChar, 10, p.usrty); PKDBHelper.SqlAddParam(parameters, "@SYSCD", SqlDbType.VarChar, 20, p.syscd); PKDBHelper.SqlAddParam(parameters, "@ISMBL", SqlDbType.VarChar, 1, p.ismbl); DataTable dt = dbAccess.ExecuteSpDataSet(query, parameters).Tables[0]; if (dt.Rows.Count > 0) { return JsonConvert.SerializeObject(dt, Formatting.Indented); } else { return string.Empty; } } else { return string.Empty; } }
private string execute(salsum s) { SqlDbAccess dbAccess = new SqlDbAccess(PKDBHelper.ConnectString); dbAccess.CommandTimeout = 120; string jsonset = string.Empty; if (("{SLT}{SLT2}{SLT3}").IndexOf("{" + s.rmode + "}") >= 0) { string query = @"MBL_SALSUM_Q1"; SqlParamCollection parameters = new SqlParamCollection(); PKDBHelper.SqlAddParam(parameters, "@INFDS", SqlDbType.VarChar, 100, s.infds); PKDBHelper.SqlAddParam(parameters, "@RTNCD", SqlDbType.VarChar, 100, s.rtncd); PKDBHelper.SqlAddParam(parameters, "@RMODE", SqlDbType.VarChar, 20, s.rmode); PKDBHelper.SqlAddParam(parameters, "@TDATE", SqlDbType.VarChar, 8, s.tdate); PKDBHelper.SqlAddParam(parameters, "@SLTTG", SqlDbType.VarChar, 10, s.slttg); DataTable dt = dbAccess.ExecuteSpDataSet(query, parameters).Tables[0]; if (dt.Rows.Count > 0) { return JsonConvert.SerializeObject(dt); //, Formatting.Indented); } else { return string.Empty; } } else { return string.Empty; } }
private string execute(usrmas p) { SqlDbAccess dbAccess = new SqlDbAccess(PKDBHelper.ConnectString); string jsonset = string.Empty; if (("{CHKUSR}{CHKAUTH}{SLT}").IndexOf("{" + p.rmode + "}") >= 0) { string query = @"MBL_USRMAS_M1"; SqlParamCollection parameters = new SqlParamCollection(); PKDBHelper.SqlAddParam(parameters, "@INFDS", SqlDbType.VarChar, 100, p.infds); PKDBHelper.SqlAddParam(parameters, "@RTNCD", SqlDbType.VarChar, 100, p.rtncd); PKDBHelper.SqlAddParam(parameters, "@RMODE", SqlDbType.VarChar, 20, p.rmode); PKDBHelper.SqlAddParam(parameters, "@USRID", SqlDbType.VarChar, 10, p.usrid); PKDBHelper.SqlAddParam(parameters, "@PASWD", SqlDbType.VarChar, 10, p.paswd); PKDBHelper.SqlAddParam(parameters, "@IPADR", SqlDbType.VarChar, 20, p.ipadr); PKDBHelper.SqlAddParam(parameters, "@FDATE", SqlDbType.Char, 8, p.fdate); PKDBHelper.SqlAddParam(parameters, "@TDATE", SqlDbType.Char, 8, p.tdate); PKDBHelper.SqlAddParam(parameters, "@SSNID", SqlDbType.VarChar, 50, p.ssnid); PKDBHelper.SqlAddParam(parameters, "@FRMNM", SqlDbType.VarChar, 100, p.frmnm); //PKDBHelper.SqlAddParam(parameters, "@DPTCD", SqlDbType.Char, 20, p.dptcd); //PKDBHelper.SqlAddParam(parameters, "@USEYN", SqlDbType.Char, 1, p.useyn); DataTable dt = dbAccess.ExecuteSpDataSet(query, parameters).Tables[0]; if (dt.Rows.Count > 0) { return JsonConvert.SerializeObject(dt, Formatting.Indented); //if (dt.Rows[0]["RESULT"].ToString() == "OK") //{ // return "OK"; //} //else //{ // if (dt.Rows[0]["MSGID"].ToString() == "ERR0008") // { // return "ERR_USER"; // //PKMessageBox.ShowError("사용자가 등록되어 있지 않습니다!", DialogButtons.Ok, "로그인 에러"); // } // else // { // return "ERR_PWD"; // //PKMessageBox.ShowError("비밀번호를 다시 입력하세요!", DialogButtons.Ok, "로그인 에러"); // } //} } else { return string.Empty; } } else { return string.Empty; } }
private string execute(dptmas d) { SqlDbAccess dbAccess = new SqlDbAccess(PKDBHelper.ConnectString); string jsonset = string.Empty; if (("{SLT}").IndexOf("{" + d.rmode + "}") >= 0) { string query = @"MBL_DPTMAS_M1"; SqlParamCollection parameters = new SqlParamCollection(); PKDBHelper.SqlAddParam(parameters, "@INFDS", SqlDbType.VarChar, 100, d.infds); PKDBHelper.SqlAddParam(parameters, "@RTNCD", SqlDbType.VarChar, 100, d.rtncd); PKDBHelper.SqlAddParam(parameters, "@RMODE", SqlDbType.VarChar, 20, d.rmode); PKDBHelper.SqlAddParam(parameters, "@DPTCD", SqlDbType.VarChar, 10, d.dptcd); DataTable dt = dbAccess.ExecuteSpDataSet(query, parameters).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if(dt.Rows[i]["HPTEL"].ToString().Trim()!=string.Empty) { dt.Rows[i]["HPTEL"] = CryptoHelper.DecryptText(dt.Rows[i]["HPTEL"].ToString().Trim()); } if (dt.Rows[i]["EMAIL"].ToString().Trim() != string.Empty) { dt.Rows[i]["EMAIL"] = CryptoHelper.DecryptText(dt.Rows[i]["EMAIL"].ToString().Trim()); } if (dt.Rows[i]["TELNO"].ToString().Trim() != string.Empty) { dt.Rows[i]["TELNO"] = CryptoHelper.DecryptText(dt.Rows[i]["TELNO"].ToString().Trim()); } //if (dt.Rows[i]["GNAME"].ToString().Trim() != string.Empty) //{ // dt.Rows[i]["GNAME"] = "XXX"; //dt.Rows[i]["GNAME"].ToString().Trim().Replace('(', 'X').Replace(')', 'Y'); //} } return JsonConvert.SerializeObject(dt); //, Formatting.Indented); } else { return string.Empty; } } else { return string.Empty; } }
public ControlPluginCollection GetControlPlugins() { var command = SqlDbAccess.CreateTextCommand(); command.CommandText = @" SELECT ControlPluginId, ControlType, Name, ImageUrl, Category FROM [Cerberus.TemplateEngine.ControlPlugin] WHERE Enabled=1" ; return(ControlPluginCollection.CreateFromData(SqlDbAccess.ExecuteSelect(command))); }
//Function to insert userinformation public bool Insert(UserInfo userObj) { SqlDbAccess dbAccessObj = new SqlDbAccess(); SqlCommand cmd = dbAccessObj.GetCommand("INSERT INTO UserInfo VALUES(@title1, @title2, @title3, @title4, @title5, @title6, @title7, @title8, @title9, @title10)"); cmd.Connection.Open(); SqlParameter param1 = new SqlParameter("@title1", SqlDbType.VarChar, 20); param1.Value = userObj.Name; SqlParameter param2 = new SqlParameter("@title2", SqlDbType.VarChar, 50); param2.Value = userObj.Contact; SqlParameter param3 = new SqlParameter("@title3", SqlDbType.VarChar, 50); param3.Value = userObj.Email; SqlParameter param4 = new SqlParameter("@title4", SqlDbType.VarChar, 5); param4.Value = userObj.BloodGroup; SqlParameter param5 = new SqlParameter("@title5", SqlDbType.VarChar, 10); param5.Value = userObj.Religion; SqlParameter param6 = new SqlParameter("@title6", SqlDbType.VarChar, 10); param6.Value = userObj.Gender; SqlParameter param7 = new SqlParameter("@title7", SqlDbType.VarChar, 50); param7.Value = userObj.LastDateOfBloodDonatin; SqlParameter param8 = new SqlParameter("@title8", SqlDbType.VarChar, 20); param8.Value = userObj.Division; SqlParameter param9 = new SqlParameter("@title9", SqlDbType.VarChar, 10); param9.Value = userObj.Area; SqlParameter param10 = new SqlParameter("@title10", SqlDbType.VarChar, 50); param10.Value = userObj.PassWord; cmd.Parameters.Add(param1); cmd.Parameters.Add(param2); cmd.Parameters.Add(param3); cmd.Parameters.Add(param4); cmd.Parameters.Add(param5); cmd.Parameters.Add(param6); cmd.Parameters.Add(param7); cmd.Parameters.Add(param8); cmd.Parameters.Add(param9); cmd.Parameters.Add(param10); int val = cmd.ExecuteNonQuery(); cmd.Connection.Close(); return(val > 0); }
// GET api/values/5 public string Get(int id) { var sqlDbAccess = new SqlDbAccess(); return(sqlDbAccess.GetData()); }