protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-7")) { Act = HTTPRequest.GetString("Act"); if (Act == "Edit") { OrderFieldID = Utils.StrToInt(HTTPRequest.GetString("oid"), 0); oi = Orders.GetOrderFieldInfoModel(OrderFieldID); } if (ispost) { fName = Utils.ChkSQL(HTTPRequest.GetString("fName")); OrderType = Utils.StrToInt(Utils.ChkSQL(HTTPRequest.GetString("OrderType")), 0); fType = Utils.StrToInt(Utils.ChkSQL(HTTPRequest.GetString("fType")), 0); fState = HTTPRequest.GetString("fState").Trim() != "" ? Utils.StrToInt(HTTPRequest.GetString("fState"), 0) : 1; fPrint = HTTPRequest.GetString("fPrint").Trim() != "" ? Utils.StrToInt(HTTPRequest.GetString("fPrint"), 0) : 1; fPrintAdd = HTTPRequest.GetString("fPrintAdd").Trim() != "" ? Utils.StrToInt(HTTPRequest.GetString("fPrintAdd"), 0) : 1; fProductField = Utils.ChkSQL(HTTPRequest.GetString("fProductField")); oi.OrderType = OrderType; oi.fType = fType; oi.fState = fState; oi.fPrint = fPrint; oi.fPrintAdd = fPrintAdd; oi.fProductField = fProductField; if (Act == "Add") { oi.fName = fName; if (!Orders.ExistsOrderFieldInfo(OrderType, fName)) { if (Orders.AddOrderFieldInfo(oi) > 0) { AddMsgLine("创建成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } else { AddErrLine("创建失败!"); AddScript("window.setTimeout('history.back(1);',1000);"); } } else { AddErrLine("字段:" + fName + ",已存在,请更换!"); AddScript("window.setTimeout('history.back(1);',1000);"); } } if (Act == "Edit") { if (oi.fName != fName) { if (Orders.ExistsOrderFieldInfo(OrderType, fName)) { AddErrLine("字段:" + fName + ",已存在,请更换!"); AddScript("window.setTimeout('history.back(1);',1000);"); } } if (!IsErr()) { try { oi.fName = fName; Orders.UpdateOrderFieldInfo(oi); AddMsgLine("修改成功!"); AddScript("window.setTimeout('window.parent.HidBox();',1000);"); } catch (Exception ex) { AddErrLine("修改失败!<br/>" + ex); AddScript("window.setTimeout('window.parent.HidBox();',5000);"); } } } } else { if (Act == "Del") { try { Orders.DeleteOrderFieldInfo(HTTPRequest.GetString("oid")); AddMsgLine("删除成功!"); AddScript("window.setTimeout('window.parent.HidBox();',2000);"); } catch (Exception ex) { AddErrLine("创建失败!<br/>" + ex); AddScript("window.setTimeout('window.parent.HidBox();',5000);"); } } else { Order_Type = Orders.GetOrder_Type(); OrderFieldTypes = Orders.GetOrderFieldTypes(); } } } else { AddErrLine("权限不足!"); AddScript("window.setTimeout('window.parent.HidBox();',2000);"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }