protected void confirmUpload_Click(object sender, EventArgs e) { tmp.Text = ""; using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { string sql = "sp_gam_b2f_overwrite"; SqlCommand cmd = new SqlCommand(sql); cmd.CommandType = CommandType.StoredProcedure; sqldb.execSqlWithCmd(ref cmd); //cmd.Dispose(); cmd = new SqlCommand("sp_gam_b2f_add"); cmd.CommandType = CommandType.StoredProcedure; foreach (ListViewDataItem item in listMain.Items) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@fcPeriod", ((Label)item.FindControl("period")).Text); cmd.Parameters.AddWithValue("@sales", ((Label)item.FindControl("sales")).Text); cmd.Parameters.AddWithValue("@oem", ((Label)item.FindControl("oem")).Text); cmd.Parameters.AddWithValue("@cpn", ((Label)item.FindControl("cpn")).Text); cmd.Parameters.AddWithValue("@pn", ((Label)item.FindControl("ipn")).Text); cmd.Parameters.AddWithValue("@sqft", Convert.ToSingle(((Label)item.FindControl("sqft")).Text)); cmd.Parameters.AddWithValue("@qty", ((Label)item.FindControl("qty")).Text); cmd.Parameters.AddWithValue("@array", ((Label)item.FindControl("array")).Text); cmd.Parameters.AddWithValue("@smt", ((Label)item.FindControl("smt")).Text); cmd.Parameters.AddWithValue("@fpc", ((Label)item.FindControl("fpc")).Text); cmd.Parameters.AddWithValue("@bom", ((Label)item.FindControl("bom")).Text); sqldb.execSqlWithCmd(ref cmd); } cmd.Connection.Dispose(); cmd.Dispose(); } loadExistsData(); }
public static void copyPreviousPreiodForecastData(int period, int salesman) { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_SalesFCST_copy_previous_preiod"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sid", salesman); cmd.Parameters.AddWithValue("@period", period); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public static DataTable getB2FResult(int period) { string msg = ""; DataTable dt = new DataTable(); using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { string sql = "sp_gam_b2f_report"; SqlCommand cmd = new SqlCommand(sql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@up", period); SqlParameter _msg = cmd.Parameters.AddWithValue("@msg", ""); _msg.Size = 200; _msg.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); msg = _msg.Value.ToString(); dt = db.getDataTableWithCmd(ref cmd); cmd.Dispose(); } return dt; }
public string delOEMComments(int comment_id, int oemid) { string author = ""; if (HttpContext.Current.Session["usr"] != null) { nUser usr = (nUser)Session["usr"]; author = usr.userName; usr.Dispose(); } if (author != "") { using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_oem_comments_del"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@comment_id", comment_id); cmd.Parameters.AddWithValue("@author", author); db.execSqlWithCmd(ref cmd); cmd.Dispose(); } } return getOEMComments(oemid); }
public string updateOLS_TopSide_adjust(int period, int oemid, int amt, string adjustType, int x, int y) { int gtt = 0; int stt = 0; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_forecast_TopSide_adjustment"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@oemid", oemid); cmd.Parameters.AddWithValue("@period", period); cmd.Parameters.AddWithValue("@adjust", amt); cmd.Parameters.AddWithValue("@isOLS", (adjustType == "ols") ? true : false); SqlParameter _gtt = cmd.Parameters.AddWithValue("@grandTtl", 0); _gtt.Direction = ParameterDirection.Output; SqlParameter _stt = cmd.Parameters.AddWithValue("@salesTtl", 0); _stt.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); gtt = Convert.ToInt32(_gtt.Value); stt = Convert.ToInt32(_stt.Value); cmd.Dispose(); } return "{x:" + x.ToString() + ",y:" + y.ToString() + ",amt:" + amt.ToString() + ",gtt:" + gtt.ToString() + ",stt:" + stt.ToString() + "}"; }
public string setCusPartRemark(int oemid, string customerPart, string new_remark, float new_asp) { string remark = "{}"; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_gam_actualItemRemark_set"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@oemid", oemid); cmd.Parameters.AddWithValue("@part_no", customerPart.Trim()); cmd.Parameters.AddWithValue("@remark", new_remark.Trim()); cmd.Parameters.AddWithValue("@asp",new_asp); db.execSqlWithCmd(ref cmd); cmd.Dispose(); remark = getCusPartRemark(oemid, customerPart); } return remark; }
public string getCusPartRemark(int oemid, string customerPart) { string remark = "{}"; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_gam_actualItemRemark_get"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@oemid", oemid); cmd.Parameters.AddWithValue("@part_no", customerPart); SqlParameter _rmk = cmd.Parameters.Add(new SqlParameter("@remark", SqlDbType.NVarChar, 1000)); _rmk.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); cmd.Dispose(); remark = _rmk.Value.ToString().Replace(System.Environment.NewLine, "\\n "); } return remark; }
public static void update(int manager_id, int sysUserId) { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("[sp_gam_salesmanChangeManager]"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@managerId", manager_id); cmd.Parameters.AddWithValue("@sysId", sysUserId); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public void Update() { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_CusOEMUpdate"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CusOEM",CusOEM); cmd.Parameters.AddWithValue("@BaanId", BaanId); cmd.Parameters.AddWithValue("@salesmanId", salesmanId); cmd.Parameters.AddWithValue("@OEMID", OEMID); cmd.Parameters.AddWithValue("@isValid", isValid); cmd.Parameters.AddWithValue("@viewSalesmanId", viewSalesmanId); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public void Add() { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_CusOEMAdd"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CusOEM", CusOEM); cmd.Parameters.AddWithValue("@BaanId", BaanId); cmd.Parameters.AddWithValue("@salesmanId", salesmanId); cmd.Parameters.AddWithValue("@viewSalesmanId", viewSalesmanId); SqlParameter par1 = cmd.Parameters.AddWithValue("@OEMID", 0); par1.Direction = ParameterDirection.Output; sqldb.execSqlWithCmd(ref cmd); _OEMID = Convert.ToInt32(par1.Value); cmd.Dispose(); } }
public static void bkSalesDel(int sysid) { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("delete GAM_OEM_salesman where id=@id"); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@id", sysid); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public static void bkSalesAdd(int oemid, int salesman_id) { string sql = "insert into gam_oem_salesman (oem_id,baan_id,salesman_id,salesman_type)" + "select oemid,baanid,@sid,3 from GAM_OEM where oemid=@oemid"; using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(sql); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@sid", salesman_id); cmd.Parameters.AddWithValue("@oemid", oemid); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public static void getCEMOEM_Forecast() { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_cem_forecast_mix_result"); cmd.CommandType = CommandType.StoredProcedure; sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public nUser(string user_id, string domainName) { _isLdapUser = _isDbUser = false; domain = "asia"; if (domainName != "") domain = domainName; Multek.LDAP ldap = new Multek.LDAP(@"LDAP://DC=" + domain + ",DC=ad,DC=flextronics,DC=com"); if (ldap.findUser(user_id,domain)) { _isLdapUser = true; _UID = ldap.uid; userName = ldap.name; emailAddress = ldap.email; jobTitle = ldap.title; fax = ldap.fax; tel = ldap.tel; mobile = ldap.mobile; ipphone = ldap.ipPhone; department = ldap.department; DataTable dt = getDbUser(_UID, domain); if (dt.Rows.Count == 1) { DataRow row = dt.Rows[0]; _isDbUser = true; _sysUserId = (int)row["sysUserId"]; managerId = (int)row["managerId"]; isReportViewer = (bool)row["isReportViewer"]; isSales = (bool)row["isSales"]; isActive = (bool)row["isActive"]; isAdmin = (bool)row["isAdmin"]; isPriceView = (bool)row["isPriceView"]; uGroup = row["uGroup"].ToString(); } } else { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_GAM_UserUpdate"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", user_id); cmd.Parameters.AddWithValue("@domain", domain); cmd.Parameters.AddWithValue("@username", "unknow"); cmd.Parameters.AddWithValue("@isReportViewer", false); cmd.Parameters.AddWithValue("@isSales", false); cmd.Parameters.AddWithValue("@isActive", false); cmd.Parameters.AddWithValue("@isAdmin", false); cmd.Parameters.AddWithValue("@isPriceView", false); cmd.Parameters.AddWithValue("@group", "Disabled"); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } _UID = domain = ""; msg = "User not found."; } ldap.Dispose(); }
public bool updateDBUser() { if (_isLdapUser && _isDbUser) { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_GAM_UserUpdate"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", UID); cmd.Parameters.AddWithValue("@domain", domain); cmd.Parameters.AddWithValue("@username", userName); cmd.Parameters.AddWithValue("@isReportViewer", isReportViewer); cmd.Parameters.AddWithValue("@isSales", isSales); cmd.Parameters.AddWithValue("@isActive", isActive); cmd.Parameters.AddWithValue("@isAdmin", isAdmin); cmd.Parameters.AddWithValue("@isPriceView", isPriceView); cmd.Parameters.AddWithValue("@group", uGroup); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } } return true; }
public bool addDBUser() { if (_isLdapUser && !_isDbUser) { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_GAM_UserAdd"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", UID); cmd.Parameters.AddWithValue("@domain", domain); cmd.Parameters.AddWithValue("@username", userName); cmd.Parameters.AddWithValue("@managerId", managerId); cmd.Parameters.AddWithValue("@isReportViewer", isReportViewer); cmd.Parameters.AddWithValue("@isSales", isSales); cmd.Parameters.AddWithValue("@isActive", isActive); cmd.Parameters.AddWithValue("@isAdmin", isAdmin); cmd.Parameters.AddWithValue("@emailAddress", emailAddress); cmd.Parameters.AddWithValue("@department", department); cmd.Parameters.AddWithValue("@jobTitle", jobTitle); cmd.Parameters.AddWithValue("@fax", fax); cmd.Parameters.AddWithValue("@tel", tel); cmd.Parameters.AddWithValue("@isPriceView", isPriceView); cmd.Parameters.AddWithValue("@group", uGroup); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } } return true; }
public static void submit_finish_forecast(int salesman_id, int period) { string sql = "insert into gam_salesman_submit (sales_id,period,submit_time) values (@salesman_id,@period,getdate())"; using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(sql); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@salesman_id", salesman_id); cmd.Parameters.AddWithValue("@period", period); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }
public static int updateforecastPN(int period, int oemid, string customerPart, int amt, int salesId) { int tamt = 0; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_gam_forecastCustomerPart_Update"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@period", period); cmd.Parameters.AddWithValue("@oemid", oemid); cmd.Parameters.AddWithValue("@project", customerPart); cmd.Parameters.AddWithValue("@amt", amt); cmd.Parameters.AddWithValue("@salesmanId", salesId); SqlParameter _tamt = cmd.Parameters.AddWithValue("@tamt", 0); _tamt.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); tamt = Convert.ToInt32(_tamt.Value); } return tamt; }
public static string submitFirstLock_salesmanLog() { string msg = ""; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_AutoSave_Forecast_1SalesLog"); cmd.CommandType = CommandType.StoredProcedure; SqlParameter _msg = cmd.Parameters.AddWithValue("@msg", ""); _msg.Size = 100; _msg.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); msg = _msg.Value.ToString(); } return msg; }
public string getCusPartForecastUpdate(int period, int oemid, string customerPart, int amt,string cellid, bool resetTable) { int salesId = 0; if (customerPart.IndexOf("<") >= 0 || customerPart.IndexOf(">") > 0) { return "obj = {cell:\"\",error:1,message:\"error, invalid part number!! "+ customerPart.Replace("\"","'") +"\"}"; } if (HttpContext.Current.Session["usr"] != null) { nUser usr = (nUser)Session["usr"]; salesId = usr.sysUserId; usr.Dispose(); } int tamt = 0; using (Multek.SqlDB db = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_gam_forecastCustomerPart_Update"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@period", period); cmd.Parameters.AddWithValue("@oemid", oemid); cmd.Parameters.AddWithValue("@project", customerPart); cmd.Parameters.AddWithValue("@amt", amt); cmd.Parameters.AddWithValue("@salesmanId", salesId); SqlParameter _tamt = cmd.Parameters.AddWithValue("@tamt", 0); _tamt.Direction = ParameterDirection.Output; db.execSqlWithCmd(ref cmd); tamt = Convert.ToInt32(_tamt.Value); } if (resetTable) return GETFS(period, oemid); else return "obj = {\"amt\":\""+ amt.ToString() +"\",\"tamt\":\"" + tamt.ToString() +"\",\"cell\":\"" + cellid +"\"}"; }
public void update() { using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_gam_BaanOEMupdate"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@groupname", GroupName); cmd.Parameters.AddWithValue("@oemid", _BaanOEMID); sqldb.execSqlWithCmd(ref cmd); cmd.Dispose(); } }