protected void cmdCopyOk_Click(object sender, EventArgs e) { try { string iidstr = txtIidstr.Value; int dest_cid = int.Parse(ddlCopycid.SelectedValue); lstError = new List<Errorobject>(); if (CFunctions.IsNullOrEmpty(iidstr) || dest_cid == 0) { lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Copy_error, "", null); Master.Form_ShowError(lstError); return; } CProduct BLL = new CProduct(CCommon.LANG); string[] iidarr = iidstr.Split(','); for (int i = 0; i < iidarr.Length; i++) { ProductInfo info = BLL.Wcmm_Getinfo(int.Parse(iidarr[i])); this.Copy_Info(info, dest_cid, BLL); } cmdCopyOk.Enabled = false; lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Copy_completed, "", null); Master.Form_ShowError(lstError); } catch (Exception ex) { CCommon.CatchEx(ex); } }
public void Set(string relateditem) { try { string vlreturn = "<table id=\"RP_listselectedProduct\" class=\"RP_listselectedProduct\">"; List<ProductInfo> list = new List<ProductInfo>(); if (!CFunctions.IsNullOrEmpty(relateditem)) { list = new CProduct(CCommon.LANG).Wcmm_Getlist(relateditem); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ProductInfo info = (ProductInfo)list[i]; vlreturn += "<tr id=\"rprowi" + i + "\" class=\"rprowi\">" + "<td class=\"rpbase\"><img id=\"rpimag" + i + "\" src=\"" + (info.Filepreview.IndexOf(CConstants.WEBSITE) == 0 ? info.Filepreview : (CConstants.WEBSITE + "/" + info.Filepreview)) + "\" /></td>" + "<td class=\"rpnote\">" + info.Name + "</td>" + "<td class=\"rpsort\">" + info.Cname + "</td>" + "<td class=\"rpcomd\"><a href=\"javascript:RPremove(" + info.Id + "," + i + ");\">x</a></td></tr>"; } } } RP_containerProduct.InnerHtml = vlreturn + "</table>"; RP_containerProduct.Attributes.Add("title", list == null ? "0" : list.Count.ToString()); RP_txtRelatedid.Value = relateditem; return; } catch (Exception ex) { CCommon.CatchEx(ex); } }
public void ProcessRequest(HttpContext context) { string cid = context.Request.QueryString["cid"]; string vlreturn = ""; if (!CFunctions.IsNullOrEmpty(cid) && cid != "0") { vlreturn = "{\"productinfo\":["; List<ProductInfo> list = new CProduct(CCommon.LANG).Wcmm_Getlist(int.Parse(cid)); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ProductInfo info = (ProductInfo)list[i]; vlreturn += "{\"productname\":\"" + info.Name.Replace("\"", "\\\"") + "\", \"productid\":\"" + info.Id + "\"}" + (i == list.Count - 1 ? "" : ","); } } vlreturn += "]}"; } string iid = context.Request.QueryString["iid"]; if (!CFunctions.IsNullOrEmpty(iid)) { vlreturn = "{\"productinfo\":["; List<ProductInfo> list = new CProduct(CCommon.LANG).Wcmm_Getlist(iid); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ProductInfo info = (ProductInfo)list[i]; vlreturn += "{\"productname\":\"" + info.Name.Replace("\"", "\\\"") + "\", \"productid\":\"" + info.Id + "\", \"productimage\":\"" + info.Filepreview + "\", \"productcategory\":\"" + info.Cname + "\"}" + (i == list.Count - 1 ? "" : ","); //vlreturn += "<tr id=\"rprowi" + i + "\" class=\"rprowi\">" // + "<td class=\"rpbase\"><img id=\"rpimag" + i + "\" src=\"" + (proinfo.Filepreview.IndexOf(WEBSITE) == 0 ? proinfo.Filepreview : (WEBSITE + "/" + proinfo.Filepreview)) + "\" /></td>" //+ "<td class=\"rpnote\">" + proinfo.Name + "</td>" //+ "<td title=\"" + proinfo.Id + "\" class=\"rpcomd\"><a href=\"javascript:RPremove(" + proinfo.Id + "," + i + ");\">x</a></td></tr>"; } } vlreturn += "]}"; } context.Response.ContentType = "text/plain"; context.Response.Write(vlreturn); }
public List<CartitemInfo> Getlistfull(int cartid) { try { List<CartitemInfo> arr = null; using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM)) { string SQL = SQL_GETIFO + " AND A.cartid=@CARTID"; iSqlParameter[] parms = new iSqlParameter[]{ new iSqlParameter(PARM_CARTID, iSqlType.Field_tInterger), }; int i = -1; parms[++i].Value = cartid; using (iSqlDataReader dar = HELPER.executeReader(iConn, iCommandType.Text, SQL, parms)) { CProduct DALProduct = new CProduct(LANG); while (dar.Read()) { CartitemInfo info = this.getDataReader(dar); info.iProduct = DALProduct.Getinfo(info.ProductID); if (arr == null) arr = new List<CartitemInfo>(); arr.Add(info); } } iConn.Close(); } return arr; } catch (Exception ex) { throw ex; } }
private void Move_Info(ProductInfo source_info, int dest_cid, CProduct BLL) { if (source_info == null) return; ProductInfo info_copy = source_info.copy(); info_copy.Cid = dest_cid; info_copy.Status = CCommon.GetStatus_upt(); info_copy.Username = CCommon.Get_CurrentUsername(); info_copy.Timeupdate = DateTime.Now; BLL.Save(info_copy); }
private void Copy_Info(ProductInfo source_info, int dest_cid, CProduct BLL) { if (source_info == null) return; ProductInfo info_copy = source_info.copy(); info_copy.Id = 0; info_copy.Cid = dest_cid; info_copy.Status = CCommon.GetStatus_upt(); info_copy.Username = CCommon.Get_CurrentUsername(); info_copy.Timeupdate = DateTime.Now; info_copy.Allowcomment = source_info.Allowcomment > 0 ? 1 : 0; info_copy.Orderd = 0; BLL.Save(info_copy); }
protected void cmdUpdateorder_Click(object sender, ImageClickEventArgs e) { try { if (grdView.Rows.Count == 0) return; CProduct BLL = new CProduct(CCommon.LANG); foreach (GridViewRow row in grdView.Rows) { HiddenField txtId = (HiddenField)row.FindControl("txtId"); TextBox txtOrderd = (TextBox)row.FindControl("txtOrderd"); if (txtId != null && txtOrderd != null) { int id = int.Parse(txtId.Value); int orderd = 0; int.TryParse(txtOrderd.Text, out orderd); BLL.Updatenum(id.ToString(), Queryparam.Sqlcolumn.Orderd, orderd); } lstError = new List<Errorobject>(); lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Saveorderd_completed, "", null); Master.Form_ShowError(lstError); } } catch { lstError = new List<Errorobject>(); lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Saveorderd_error, "", null); Master.Form_ShowError(lstError); } }
private bool Save_Lang(ProductInfo info) { try { if (!CFunctions.IsMultiLanguage() || !chkSaveoption_golang.Checked) return false; int lang_num = CConstants.LANG_NUM; for (int i = 0; i < lang_num; i++) { string lang_val = ConfigurationSettings.AppSettings["LANG_" + i]; if (lang_val == CCommon.LANG) continue; ProductInfo lang_info = info.copy(); lang_info.Id = 0; lang_info.Status = (int)CConstants.State.Status.Waitactive; CProduct DALProduct = new CProduct(lang_val); if (DALProduct.Save(lang_info)) { if (lang_info.lFileattach != null && lang_info.lFileattach.Count > 0) if (new CFileattach(lang_val).Save(lang_info.lFileattach, lang_info.Id)) DALProduct.Updatenum(lang_info.Id.ToString(), Queryparam.Sqlcolumn.Album, lang_info.lFileattach.Count); } } return true; } catch { return false; } }