示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsCN == false)
     {
         FinanceReportViewer.LocalReport.ReportPath = FinanceReportViewer.LocalReport.ReportPath.Replace("En", "").Replace(".rdlc", "En.rdlc");
     }
     facservComm = new ServiceCommon(base.factoryConnectionString);
     if (!IsPostBack)
     {
         if (ccWhere.sbComponent.ToString() == "")
         {
             ccWhere.AddComponent("1", "1", SearchComponent.Equals, SearchPad.NULL);
         }
         DataTable dtSeller = facservComm.ExecuteSqlDatatable("select distinct sellerid,Seller from " + vieworganizationorigin + " where " + ccWhere.sbComponent);
         this.seller.DataTextField  = "Seller";
         this.seller.DataValueField = "sellerid";
         this.seller.DataSource     = dtSeller;
         this.seller.DataBind();
         if (GetOrganization.Count > 0)
         {
             this.seller.SelectedValue = GetOrganization["sellerid"].ToString();
             this.seller.Enabled       = false;
         }
         DataTable dtPrice = new ReportDataSet.ProductPriceDataTable();
         this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtPrice));
         //BindProductPrice();
     }
     if (!String.IsNullOrEmpty(Request["refresh"]))
     {
         BindProductPrice();
     }
 }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.btnSave.Text = GetGlobalResourceObject("Resource", "Upload").ToString();
        }
        if (!string.IsNullOrEmpty(Request["hDelete"]))
        {
            ccWhere.AddComponent("ID", Request["hDelete"], SearchComponent.Equals, SearchPad.NULL);
            DataTable dt = servComm.GetListTop(0, "W_OrderAttachements", ccWhere);
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["FilePath"] != null && !String.IsNullOrEmpty(dr["FilePath"].ToString()))
                {
                    string strFileName = dr["FilePath"].ToString().Substring(dr["FilePath"].ToString().LastIndexOf("/") + 1);
                    strFileName = Request.PhysicalApplicationPath + SaveFilePath + strFileName;
                    if (File.Exists(strFileName))
                    {
                        File.Delete(strFileName);
                    }
                }
            }
            servComm.ExecuteSql(" delete from W_OrderAttachements where ID='" + Request["hDelete"] + "'");
            BindList();
        }

        BindList();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string BillNo = Request["BillNo"];

        if (!String.IsNullOrEmpty(BillNo))
        {
            ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And);
        }
        string Salesperson = Request["Salesperson"];

        if (!String.IsNullOrEmpty(Salesperson))
        {
            ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And);
        }
        string IsDel = Request["IsDel"];

        if (!String.IsNullOrEmpty(IsDel))
        {
            ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And);
        }
        else
        {
            ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And);
        }

        servComm.strOrderString = "Id";
        DataTable dtSales  = servComm.GetListTop(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere);
        string    fileName = Request.PhysicalApplicationPath + "UploadFile\\" + DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx";

        using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\"))
        {
            //int count = excelHelper.DataTableToExcel(dtSales, "订单信息", true);
        }
    }
    private void BindDailyReport(bool initFlg = false)
    {
        this.FinanceReportViewer.LocalReport.DataSources.Clear();
        if (initFlg)
        {
            this.FinanceReportViewer.Visible = false;
        }
        else
        {
            this.FinanceReportViewer.Visible = true;
            ccWhere.AddComponent("indate", Request["txtdatefrom"], SearchComponent.GreaterOrEquals, SearchPad.And);
            ccWhere.AddComponent("indate", Request["txtdateto"], SearchComponent.LessOrEquals, SearchPad.And);

            GetFilterByKind(ref ccWhere, "Report");

            if (ccWhere.sbComponent.ToString() == "")
            {
                ccWhere.AddComponent("1", "1", SearchComponent.Equals, SearchPad.NULL);
            }

            DataTable dtModelProcessing = facservComm.ExecuteSqlDatatable(ModelProcessingSummary + " and " + ccWhere.sbComponent);


            this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraIndate", "2015年01月01日"));
            this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraOutDate", DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day + "日"));
            this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtModelProcessing));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        modelBase = servComm.GetEntity <ModelBase>("1");
        string actiontype = Request["actiontype"];

        if (actiontype == "ValidCardNo")
        {
            string CardNo      = Request["CardNo"];
            string PatientName = Request["PatientName"];
            ccwhere.Clear();
            ccwhere.AddComponent("CardNo", CardNo, SearchComponent.Equals, SearchPad.NULL);
            ccwhere.AddComponent("patient", PatientName, SearchComponent.Equals, SearchPad.And);
            DataTable dtOrders    = servComm.GetListTop(0, "(select a.*,b.Client from orders a left join Client b on a.Serial = b.Serial) c", ccwhere);
            var       timeConvert = new IsoDateTimeConverter();
            //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConvert.DateTimeFormat = "yyyy-MM-dd";
            string responseJson = JsonConvert.SerializeObject(dtOrders, Formatting.Indented, timeConvert);

            ccwhere.Clear();
            ccwhere.AddComponent("CardNo", CardNo, SearchComponent.Equals, SearchPad.NULL);
            DataTable dtOrdersDetail = servComm.GetListTop(0, "ordersdetail", ccwhere);
            string    detailJson     = JsonConvert.SerializeObject(dtOrdersDetail, Formatting.Indented, timeConvert);
            if (dtOrders.Rows.Count > 0)
            {
                servComm.ExecuteSql("insert into Visitor values ( getdate())");
            }
            Response.Write("[{\"RowCount\":" + dtOrders.Rows.Count + ",\"JsonData\":" + responseJson + ",\"JsonDetail\":" + detailJson + "}]");
            Response.End();
        }
    }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsCN == false)
        {
            FinanceReportViewer.LocalReport.ReportPath = FinanceReportViewer.LocalReport.ReportPath.Replace("En", "").Replace(".rdlc", "En.rdlc");
        }
        if (!IsPostBack)
        {
            string Order_ID = Request["Order_ID"];
            string serial   = Request["serial"];
            facservComm = new ServiceCommon(base.factoryConnectionString);
            ccWhere.Clear();
            ccWhere.AddComponent("EquipRec.Order_ID", Order_ID, SearchComponent.Equals, SearchPad.NULL);
            ccWhere.AddComponent("EquipRec.serial", serial, SearchComponent.Equals, SearchPad.And);

            //DataTable dtEquipRec = facservComm.GetListTop(0, "* ", "VWEquipRec", ccWhere);
            DataTable dtEquipRec = facservComm.ExecuteSqlDatatable(VWEquipRec + " where " + ccWhere.sbComponent);



            //this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraIndate", "2015年01月01日"));
            //this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraOutDate", DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day + "日"));
            this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtEquipRec));
        }
    }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Log.LogInfo("OrderList");
        facservComm = new ServiceCommon(base.factoryConnectionString);
        ccWhere.Clear();
        if (LoginUser.Kind == "B")
        {
            ccWhere.AddComponent("sellerid", LoginUser.AssocNo.ToString(), SearchComponent.Equals, SearchPad.NULL);
        }
        else if (LoginUser.Kind == "C")
        {
            ccWhere.AddComponent("hospitalid", LoginUser.AssocNo.ToString(), SearchComponent.Equals, SearchPad.NULL);
        }
        else if (LoginUser.Kind == "D")
        {
            ccWhere.AddComponent("doctorid", LoginUser.AssocNo.ToString(), SearchComponent.Equals, SearchPad.NULL);
        }
        if (ccWhere.sbComponent.ToString() == "")
        {
            ccWhere.AddComponent("1", "1", SearchComponent.Equals, SearchPad.NULL);
        }

        facservComm.strOrderString = IsCN ? " NameCN  " : " NameEN  ";

        // DataTable dtSeller = facservComm.GetListTop(0, " distinct sellerid as id,Seller as NameCN,Seller as NameEN ", "vieworganization", ccWhere);
        DataTable dtSeller = facservComm.ExecuteSqlDatatable("select distinct sellerid as id,Seller as NameCN,Seller as NameEN from " + vieworganizationorigin + " where " + ccWhere.sbComponent);

        facservComm.strOrderString = IsCN ? " NameCN  " : " NameEN  ";

        //DataTable dtHospital = facservComm.GetListTop(0, " distinct hospitalid as id,hospital as NameCN,hospital as NameEN,sellerid ", "vieworganization", ccWhere);
        DataTable dtHospital = facservComm.ExecuteSqlDatatable("select distinct hospitalid as id,hospital as NameCN,hospital as NameEN,sellerid from " + vieworganizationorigin + " where " + ccWhere.sbComponent);

        facservComm.strOrderString = IsCN ? " NameCN  " : " NameEN  ";

        //DataTable dtDoctor = facservComm.GetListTop(0, " distinct doctorid as id,doctor as NameCN,doctor as NameEN,Hospitalid", "vieworganization", ccWhere);
        DataTable dtDoctor = facservComm.ExecuteSqlDatatable("select distinct doctorid as id,doctor as NameCN,doctor as NameEN,Hospitalid from " + vieworganizationorigin + " where " + ccWhere.sbComponent);

        for (int i = 0; i < dtSeller.Rows.Count; i++)
        {
            string sellid = dtSeller.Rows[i]["id"].ToString();
            zNodes = zNodes + ",{" + "\"id\":" + sellid + ",\"pId\":0" + ",\"name\":" + "\"" + (IsCN ? dtSeller.Rows[i]["NameCN"] : dtSeller.Rows[i]["NameEN"]) + "\",\"open\": true,\"icon\":" + "\"../zTree_v3/css/zTreeStyle/img/diy/seller.png\"" + "}";
            DataRow[] drHospital = dtHospital.Select("sellerid='" + sellid + "'");
            foreach (DataRow itemHosptal in drHospital)
            {
                string hospitalID = itemHosptal["id"].ToString();
                zNodes = zNodes + ",{" + "\"id\":" + hospitalID + ",\"pId\":" + sellid + ",\"name\":" + "\"" + (IsCN?itemHosptal["NameCN"]:itemHosptal["NameEN"]) + "\",\"icon\":" + "\"../zTree_v3/css/zTreeStyle/img/diy/hospital.png\"" + "}";
                DataRow[] drDoctor = dtDoctor.Select("Hospitalid='" + hospitalID + "'");
                foreach (DataRow itemDoctor in drDoctor)
                {
                    zNodes = zNodes + ",{" + "\"id\":" + itemDoctor["id"].ToString() + ",\"pId\":" + hospitalID + ",\"name\":" + "\"" + (IsCN?itemDoctor["NameCN"]: itemDoctor["NameEN"]) + "\",\"icon\":" + "\"../zTree_v3/css/zTreeStyle/img/diy/doctor.png\"" + "}";
                }
            }
        }
        zNodes = zNodes.Length > 0 ? zNodes.Substring(1) : zNodes;
        zNodes = "[" + zNodes + "]";
        // zNodes = "[{ \"id\":1, \"pId\":0, \"name\": \"父节点1 - 展开\", \"open\": true }" +
        //",{ \"id\":11, \"pId\":1, \"name\": \"父节点11 - 折叠\" }]";
    }
        /// <summary>
        ///
        /// </summary>
        /// <param name="strUserName"></param>
        /// <param name="strPassword"></param>
        /// <param name="bolAutoSave"></param>
        /// <returns>0:成功 1:失败</returns>
        public static int doLoginEx(string strUserName, string strPassword, bool bolAutoSave)
        {
            ServiceCommon      servComm      = new ServiceCommon();
            ConditionComponent condComponent = new ConditionComponent();

            if (strUserName.IndexOf("@") > 0)
            {
                condComponent.AddComponent("UPPER(email)", strUserName.ToUpper(), SearchComponent.Equals, SearchPad.NULL);
            }
            else
            {
                condComponent.AddComponent("UPPER(username)", strUserName.ToUpper(), SearchComponent.Equals, SearchPad.NULL);
            }
            condComponent.AddComponent("password", strPassword, SearchComponent.Equals, SearchPad.And);

            loan_user objUser = servComm.GetEntity <loan_user>(null, condComponent);

            //查询用户大于0
            if (objUser.uid > 0)
            {
                HttpCookie cookie = new HttpCookie("d2012");
                //写入Cookie
                cookie.Values["EMAIL"]    = objUser.email.ToString();
                cookie.Values["PASSWORD"] = objUser.password.ToString();

                LOGINUSERINFO loginUser = new LOGINUSERINFO();
                loginUser._USERINFO = objUser;

                HttpContext.Current.Session[UserConstant.SESSION_USERINFO] = loginUser;

                HttpContext.Current.Session["email"]      = objUser.email;
                HttpContext.Current.Session["userid"]     = objUser.uid;
                HttpContext.Current.Session["emailvalid"] = objUser.emailvalid;
                HttpContext.Current.Session["username"]   = objUser.username;
                HttpContext.Current.Session["password"]   = objUser.password;
                HttpContext.Current.Session["ulevel"]     = objUser.ulevel;


                //更新最后登录时间 最后登录IP 总登录次数

                loan_user luser = servComm.GetEntity <loan_user>(objUser.uid);
                luser.lastloginIP   = HttpContext.Current.Request.UserHostAddress;
                luser.lastlogintime = DateTime.Now;
                luser.logintimes    = luser.logintimes + 1;
                servComm.Update(luser);
            }
            else
            {
                return(1);
            }
            return(0);
        }
示例#9
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (Session["factoryConnectionString"] == null)
     {
         Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + "//Weixinclient//WXLogin.aspx");
     }
     facComm = new ServiceCommon(Session["factoryConnectionString"].ToString());
     ccWhere.Clear();
     ccWhere.AddComponent("ClassID", "OrderClass", SearchComponent.Equals, SearchPad.NULL);
     dtCategory = facComm.GetListTop(0, " Code,DictName ", "DictDetail", ccWhere);
 }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request["hDelete"]))
        {
            servComm.ExecuteSql(" delete from JX_USERS where ID='" + Request["hDelete"] + "'");
        }

        ccWhere.Clear();
        if (!String.IsNullOrEmpty(Request["txtJGCName"]))
        {
            ccWhere.AddComponent("JGCName", Request["txtJGCName"], SearchComponent.Like, SearchPad.NULL);
        }

        hddpnumbers = Request["hpnumbers"];
        int iCount = 10;

        if (!string.IsNullOrEmpty(hddpnumbers))
        {
            iCount = Convert.ToInt32(hddpnumbers);
        }
        int iPageIndex = string.IsNullOrEmpty(Request["sPageID"]) ? 1 : Convert.ToInt32(Request["sPageID"]);
        int iPageCount = string.IsNullOrEmpty(Request["sPageNum"]) ? 0 : Convert.ToInt32(Request["sPageNum"]);

        servComm.strOrderString = " LastModifyTime desc ";
        IList <JX_USERS> ilist = servComm.GetList <JX_USERS>(JX_USERS.STRTABLENAME, "*", JX_USERS.STRKEYNAME, iCount, iPageIndex, iPageCount, ccWhere);

        repUserList.DataSource = ilist;
        repUserList.DataBind();
        pagecut1.iPageNum = servComm.PageCount;
    }
    protected void loginBtn_Click(object sender, EventArgs e)
    {
        string username = Request["username"];
        string password = Request["password"];

        ccWhere.Clear();
        //condComponent.AddComponent("UPPER(Alias)", strUserName.ToUpper(), SearchComponent.Equals, SearchPad.Ex);
        ccWhere.AddComponent("UPPER(UserName)", username.ToUpper(), SearchComponent.Equals, SearchPad.NULL);
        ccWhere.AddComponent("Passwd", CryptoHelper.StaticEncrypt(password), SearchComponent.Equals, SearchPad.And);
        ModelClient objUser = servComm.GetEntity <ModelClient>(null, ccWhere);

        if (objUser != null && objUser.ID > 0)
        {
            Session["UserName"] = username;
            Session["objUser"]  = objUser;
            Session["UserName"] = objUser.Client;


            //servComm.ExecuteSql("insert into Visitor values ( getdate())");

            if (objUser.Class == "S")
            {
                Session["AccessMenu"] = "S";
            }
            else
            {
                DataTable dtRole = servComm.ExecuteSqlDatatable("select Role" + objUser.Class + " from base");
                if (dtRole.Rows.Count > 0)
                {
                    Session["AccessMenu"] = dtRole.Rows[0][0].ToString();
                }
                if (Session["AccessMenu"] == null)
                {
                    Session["AccessMenu"] = "";
                }
            }


            Response.Redirect("index.aspx");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "sucess", "layer.msg('用户名或密码错误');", true);
        }
    }
    private void ConstructionCondition()
    {
        string CardNoStart = Request["CardNoStart"];

        if (!String.IsNullOrEmpty(CardNoStart))
        {
            ccwhere.AddComponent("CardNoStart", CardNoStart, SearchComponent.GreaterOrEquals, SearchPad.And);
        }
        string CardNoEnd = Request["CardNoEnd"];

        if (!String.IsNullOrEmpty(CardNoEnd))
        {
            ccwhere.AddComponent("CardNoEnd", CardNoEnd, SearchComponent.LessOrEquals, SearchPad.And);
        }
        string Salesperson = Request["Salesperson"];

        if (!String.IsNullOrEmpty(Salesperson))
        {
            ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And);
        }
    }
    private void BindSeller()
    {
        if (ccWhere.sbComponent.ToString() == "")
        {
            ccWhere.AddComponent("1", "1", SearchComponent.Equals, SearchPad.NULL);
        }
        DataTable dtSeller = facservComm.ExecuteSqlDatatable("select distinct sellerid,Seller from " + vieworganizationorigin + " where " + ccWhere.sbComponent);

        this.seller.DataTextField  = "Seller";
        this.seller.DataValueField = "sellerid";
        this.seller.DataSource     = dtSeller;
        this.seller.DataBind();
        if (IsCN)
        {
            this.seller.Items.Insert(0, new ListItem("请选择", ""));
        }
        else
        {
            this.seller.Items.Insert(0, new ListItem("Select", ""));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                ((HtmlContainerControl)Master.FindControl("HTitle")).InnerText = "产品详细";
            }
            servCommfac = new ServiceCommon(base.factoryConnectionString);
            orderID     = Request["orderID"];
            serialID    = Request["serial"];
            productid   = Request["productid"];
            ccWhere.Clear();
            ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL);
            ccWhere.AddComponent("serial", serialID, SearchComponent.Equals, SearchPad.And);
            IList <ORDERS> listOrder = servCommfac.GetListTop <ORDERS>(0, "*", "Orders", ccWhere);
            if (listOrder.Count > 0)
            {
                preOutDate = listOrder[0].preoutDate.ToShortDateString();
            }
            //ccWhere.AddComponent("productid", productid, SearchComponent.Equals, SearchPad.And);
            ccWhere.AddComponent("ProductID", productid, SearchComponent.Equals, SearchPad.And);
            DataTable            dtProduct    = servCommfac.ExecuteSqlDatatable("SELECT itemname FROM products b where id = '" + productid + "'");
            IList <ORDERSDETAIL> listProducts = servCommfac.GetListTop <ORDERSDETAIL>(0, "*", "OrdersDetail", ccWhere);
            if (listProducts.Count > 0)
            {
                productsModel.ItemName    = dtProduct.Rows.Count > 0?dtProduct.Rows[0]["itemname"].ToString():"";
                productsModel.Number      = listProducts[0].Qty.ToString();
                productsModel.righttop    = listProducts[0].a_teeth.ToString().Trim();
                productsModel.lefttop     = listProducts[0].b_teeth.ToString().Trim();
                productsModel.rightbottom = listProducts[0].c_teeth.ToString().Trim();
                productsModel.leftbottom  = listProducts[0].d_teeth.ToString().Trim();
                // listProducts[0].pr
            }

            GetProcedureList(orderID, serialID, productid);
        }
        catch (Exception ex) {
        }
    }
    private void BindFinanceView()
    {
        this.FinanceReportViewer.LocalReport.DataSources.Clear();

        string Order_ID = Request["Order_ID"];
        string serial   = Request["serial"];

        facservComm = new ServiceCommon(base.factoryConnectionString);
        ccWhere.Clear();
        ccWhere.AddComponent("Order_ID", Order_ID, SearchComponent.Equals, SearchPad.NULL);
        ccWhere.AddComponent("serial", serial, SearchComponent.Equals, SearchPad.And);

        facservComm.strOrderString = "cast(qsserial as int)";

        ccWhere.AddComponent("class", this.ItemClass.SelectedValue, SearchComponent.Equals, SearchPad.And);
        //DataTable dtProductCheckReport = facservComm.GetListTop(0, "* ", "VWProductCheckReport", ccWhere);

        DataTable dtProductCheckReport = facservComm.ExecuteSqlDatatable(VWProductCheckReport + " where " + ccWhere.sbComponent);

        //this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraIndate", "2015年01月01日"));
        //this.FinanceReportViewer.LocalReport.SetParameters(new ReportParameter("paraOutDate", DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day + "日"));
        this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtProductCheckReport));
    }
示例#16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             ((HtmlContainerControl)Master.FindControl("HTitle")).InnerText = "订单详细";
         }
         servCommfac = new ServiceCommon(base.factoryConnectionString);
         orderID     = Request["orderID"];
         serialID    = Request["serial"];
         ccWhere.Clear();
         ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL);
         ccWhere.AddComponent("serial", serialID, SearchComponent.Equals, SearchPad.And);
         IList <ORDERS> listOrder = servCommfac.GetListTop <ORDERS>(0, "seller,hospital,doctor,Patient,Order_ID,indate,preoutDate,OutDate,Sex,Age,Fenge,Require,Courier,CourierNo,OutSay,ModelNo", "orders", ccWhere);
         if (listOrder.Count > 0)
         {
             orderModel = listOrder[0];
         }
         DataTable dtProduct = servCommfac.ExecuteSqlDatatable("SELECT Order_ID,serial,ProductId,itemname FROM OrdersDetail a left join products b on a.productid = b.id where Order_ID = '" + orderID + "' and serial = '" + serialID + "'");
         for (int i = 0; i < dtProduct.Rows.Count; i++)
         {
             ProductId = dtProduct.Rows[i]["ProductId"].ToString();
             itemname  = dtProduct.Rows[i]["itemname"].ToString();
             itemnamelist.Add(itemname);
             ProductIdlist.Add(ProductId);
             for (int j = 0; j < itemnamelist.Count(); j++)
             {
                 itemname  = dtProduct.Rows[i]["itemname"].ToString();
                 ProductId = dtProduct.Rows[i]["ProductId"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        servComm = new ServiceCommon(base.factoryConnectionString);
        if (!IsPostBack)
        {
        }

        ccWhere.Clear();
        hddpnumbers = Request["hpnumbers"];
        int iCount = 10;
        //if (!string.IsNullOrEmpty(hddpnumbers))
        //{
        //    iCount = Convert.ToInt32(hddpnumbers);
        //}
        int iPageIndex = string.IsNullOrEmpty(Request["sPageID"]) ? 1 : Convert.ToInt32(Request["sPageID"]);
        int iPageCount = string.IsNullOrEmpty(Request["sPageNum"]) ? 0 : Convert.ToInt32(Request["sPageNum"]);

        string txttxtPatient = Request["txtPatient"];

        if (!string.IsNullOrEmpty(txttxtPatient))
        {
            ccWhere.AddComponent("patient ", txttxtPatient, SearchComponent.Like, SearchPad.And);
        }

        string selectedID    = Request["selectedID"];
        string selectedLevel = Request["selectedLevel"];

        if (!String.IsNullOrEmpty(selectedLevel) && !String.IsNullOrEmpty(selectedID))
        {
            if (selectedLevel == "0")
            {
                ccWhere.AddComponent("sellerid ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
            else if (selectedLevel == "1")
            {
                ccWhere.AddComponent("HospitalID ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
            else if (selectedLevel == "2")
            {
                ccWhere.AddComponent("DoctorID ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
        }

        GetFilterByKind(ref ccWhere, "orders");

        servComm.strOrderString = " regtime desc ";
        IList <ORDERSDETAIL> ilist = servComm.GetList <ORDERSDETAIL>(ORDERSDETAIL.STRTABLENAME, "regtime,Order_ID,seller,sellerid,hospital,hospitalid,doctor,patient,productName,Valid", ORDERSDETAIL.STRKEYNAME, iCount, iPageIndex, iPageCount, ccWhere);

        this.repOrderList.DataSource = ilist;
        repOrderList.DataBind();
        pagecut1.iPageNum = servComm.PageCount;
    }
示例#18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IList <ModelClient> listSeler = servComm.GetListTop <ModelClient>(0, null);
        string orderid = Request["orderid"];

        ccwhere.AddComponent("Id", orderid, SearchComponent.Equals, SearchPad.NULL);
        OrderDetail      = servComm.GetListTop(0, "ViewSalesDetail", ccwhere);
        modelSale        = servComm.GetEntity <ModelSale>(orderid);
        modelSale.Seller = listSeler.Where(le => le.Serial == modelSale.Seller).Count() > 0 ? listSeler.Where(le => le.Serial == modelSale.Seller).FirstOrDefault().Client : "";

        if (!IsPostBack)
        {
            try
            {
                foreach (Control cp in Page.Controls)
                {
                    foreach (Control ct in cp.Controls)
                    {
                        if (ct is HtmlForm)
                        {
                            foreach (Control con in ct.Controls)
                            {
                                foreach (Control ctr in con.Controls)
                                {
                                    if (ctr is TextBox)
                                    {
                                        if (ConfigurationManager.AppSettings.Get(ctr.ID) != null)
                                        {
                                            ((TextBox)ctr).Text = ConfigurationManager.AppSettings.Get(ctr.ID);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                this.Buyer.Text       = modelSale.Seller;
                this.BuyerBottom.Text = modelSale.Seller;
            }
            catch (Exception excrt)
            {
            }
        }
        else
        {
            strAction = "exportContact";
        }
    }
    private void GetAPPInfo(string loginUser)
    {
        ccWhere.Clear();
        ccWhere.AddComponent("JGCBM", "(select BelongFactory from W_USERS where UserName='******')", SearchComponent.In, SearchPad.NULL);
        ccWhere.AddComponent("APPID", null, SearchComponent.ISNOT, SearchPad.And);
        ccWhere.AddComponent("APPSECRET", null, SearchComponent.ISNOT, SearchPad.And);
        DataTable dtFactory = servComm.GetListTop(1, "JX_USERS", ccWhere);

        if (dtFactory.Rows.Count > 0)
        {
            Session["APPID"]     = dtFactory.Rows[0]["APPID"];
            Session["APPSECRET"] = dtFactory.Rows[0]["APPSECRET"];
        }

        //Session["NickName"] = "kaka";
        if (Session["APPID"] != null && Session["APPSECRET"] != null)
        {
            //try
            //{
            string      accessToken = "";
            ReturnValue retValue    = GetUserInfo(ref accessToken, Session["APPID"].ToString(), Session["APPSECRET"].ToString());
            if (retValue == null)
            {
                GeeStar.Workflow.Common.Log.LogError("空引用");
                Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + "//Weixinclient//WXLogin.aspx");
                Response.End();
            }
            GeeStar.Workflow.Common.Log.LogError(retValue.Message);
            if (StringUtils.GetJsonValue(retValue.Message, "nickname") != null)
            {
                string nickName = StringUtils.GetJsonValue(retValue.Message, "nickname").ToString();
                string headUrl  = StringUtils.GetJsonValue(retValue.Message, "headimgurl").ToString();
                picture = headUrl;
                string strWeixin_OpenID = StringUtils.GetJsonValue(retValue.Message, "openid").ToString();
                WriteCookie(UserConstant.COOKIE_SAVEDOPENID, strWeixin_OpenID);
                Session["WeixinOpenID"] = strWeixin_OpenID;
                Session["NickName"]     = nickName;
                Session["HeadUrl"]      = headUrl;
            }
            else
            {
                Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + "//Weixinclient//WXLogin.aspx");
                Response.End();
            }

            //}
            //catch (Exception ex)
            //{
            //    GeeStar.Workflow.Common.Log.LogError(ex.Message, ex);
            //    Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + "//Weixinclient//WXLogin.aspx");
            //    Response.End();
            //}
        }
    }
示例#20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        servFacCommfac = new ServiceCommon(base.factoryConnectionString);

        if (Request["action"] == "CheckOrder")
        {
            string txtOrder = Request["txtOrder"];
            ccWhere.AddComponent("Order_ID", txtOrder, SearchComponent.Equals, SearchPad.And);
            DataTable dtUser = servFacCommfac.GetListTop(1, "orders", ccWhere);
            if (dtUser.Rows.Count > 0)
            {
                Response.Write("0");
            }
            else
            {
                Response.Write("1");
            }
            Response.End();
        }

        if (Request["action"] == "VerifierOrder")
        {
            string txtOrder = Request["OrderNumber"];
            //base.IDRule
            servCommfac.ExecuteSql("update W_USERS set Passwd = '123' where UserName = '******'");
            Response.Write("1");
            Response.End();
        }

        if (yeyRequest.Params("haddinfo") == "1")
        {
            try
            {
                string ModelNo = Request["VerifierNo"];
                ModelNo = ModelNo.Replace("Verifier", "");
                string txtOrder = Request["txtOrder"];
                servCommfac.ExecuteSql("exec SPVerifyOrders '" + ModelNo + "','" + txtOrder + "','" + LoginUser.BelongFactory + "','" + LoginUser.UserName + "'");
                checkPass = "******";
            }
            catch (Exception)
            {
                checkPass = "******";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        servCommfac = new ServiceCommon(base.factoryConnectionString);


        if (Request["type"] == "GetBatch")
        {
            string batchOrderID   = Request["BatchOrderID"];
            string batchSerialID  = Request["BatchSerialID"];
            string batchProductID = Request["BatchProductID"];
            string zBatchNodes    = "";
            ccWhere.Clear();
            ccWhere.AddComponent("Order_ID", batchOrderID, SearchComponent.Equals, SearchPad.And);
            ccWhere.AddComponent("serial", batchSerialID, SearchComponent.Equals, SearchPad.And);
            ccWhere.AddComponent("Productid", batchProductID, SearchComponent.Equals, SearchPad.And);
            DataTable dt = servCommfac.GetListTop(0, "isnull(Name,'') as Name,isnull(Maker,'') as Maker,isnull(batchNo,'') as batchNo", "OrdersElement", ccWhere);
            foreach (DataRow dr in dt.Rows)
            {
                zBatchNodes = zBatchNodes + "{" + "\"ElementName\":" + "\"" + dr["Name"].ToString() + "\"" + ",\"ElementMaker\":" + "\"" + dr["Maker"].ToString() + "\"" + ",\"BatchNo\":" + "\"" + dr["batchNo"].ToString() + "\"},";
            }
            zBatchNodes = zBatchNodes.Trim(',');
            if (zBatchNodes == "")
            {
                zBatchNodes = "{}";
            }
            else
            {
                zBatchNodes = "[" + zBatchNodes + "]";
            }

            Response.Write(zBatchNodes);
            Response.End();
        }
        else
        {
            orderID  = Request["orderID"];
            serialID = Request["serial"];
            ccWhere.Clear();
            ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL);
            ccWhere.AddComponent("serial", serialID, SearchComponent.Equals, SearchPad.And);
            IList <ORDERS> listOrder = servCommfac.GetListTop <ORDERS>(0, "hospital,doctor,Patient,Order_ID,indate,preoutDate,OutDate,Sex,Age", "orders", ccWhere);
            if (listOrder.Count > 0)
            {
                orderModel = listOrder[0];
            }
            GetProcedureList(orderID, serialID);
        }
    }
    private void GetPatientList(string orderID)
    {
        int iCount     = 1;
        int iPageIndex = yeyRequest.Params("pageindex") == null ? 1 : Convert.ToInt32(yeyRequest.Params("pageindex"));
        int iPageCount = yeyRequest.Params("hPageNum") == null ? 0 : Convert.ToInt32(yeyRequest.Params("hPageNum"));

        ccWhere.Clear();


        ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL);
        servCommfac.strOrderString = "id";

        string    countsql    = "select count(1) FROM orders a inner join OrdersDetail b on a.Order_ID = b.Order_ID and a.serial = b.serial inner join products c on b.ProductId = c.id  where a.outflag = 'N' and  a.Order_ID = '" + orderID + "' and a.serial = 0 ";
        DataTable dtCount     = servCommfac.ExecuteSqlDatatable(countsql);
        int       AllRowCount = int.Parse(dtCount.Rows[0][0].ToString());

        string sqlview = "select * from ( select ROW_NUMBER() over(order by a.Order_ID) as rowIndex ,a.Order_ID,a.serial,a.ModelNo,a.seller,a.sellerid,a.hospital,a.hospitalid,a.doctor,a.patient,b.subId,c.itemname as productName,c.Valid,b.a_teeth,b.b_teeth,b.c_teeth,b.d_teeth,a.regtime,a.Area,b.bColor,a.OutDate,a.tel,a.QlyName,a.QlyTime,c.LinkCard as Element "
                         + " FROM orders a inner join OrdersDetail b on a.Order_ID = b.Order_ID and a.serial = b.serial inner join products c on b.ProductId = c.id  where a.outflag = 'N' and  a.Order_ID = '" + orderID + "' and a.serial = '" + 0 + "' ) t where rowindex between '" + ((iPageIndex - 1) * iCount + 1).ToString() + "' and '" + (iPageIndex * iCount).ToString() + "'";

        DataTable dtZhujian = servCommfac.ExecuteSqlDatatable(sqlview);



        dtZhujian.TableName = "DataPatient";
        if (iPageCount <= 1 && dtZhujian.Rows.Count > 0)
        {
            iPageCount = ((AllRowCount - 1) / iCount) + 1;
            iPageIndex = 1;
        }

        string backstr = Json.DataTable2Json(dtZhujian, ",\"PageCount\":" + iPageCount.ToString());

        if (backstr.IndexOf("\\") >= 0)
        {
            backstr = backstr.Replace("\\", "\\\\");
        }

        Response.Write(backstr);
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["action"] == "CheckUserName")
        {
            string txtUserName = Request["txtUserName"];
            ccWhere.AddComponent("UserName", txtUserName, SearchComponent.Equals, SearchPad.And);
            DataTable dtUser = servComm.GetListTop(1, "W_USERS", ccWhere);
            if (dtUser.Rows.Count > 0)
            {
                Response.Write("1");
            }
            else
            {
                Response.Write("0");
            }
            Response.End();
        }

        if (yeyRequest.Params("haddinfo") == "1")
        {
            string UserName = Request["txtUserName"];
            servComm.ExecuteSql("update W_USERS set Passwd = '123' where UserName = '******'");
        }
    }
示例#24
0
    private void GetProcedureList(string orderID)
    {
        int iCount     = 6;
        int iPageIndex = yeyRequest.Params("pageindex") == null ? 1 : Convert.ToInt32(yeyRequest.Params("pageindex"));
        int iPageCount = yeyRequest.Params("hPageNum") == null ? 0 : Convert.ToInt32(yeyRequest.Params("hPageNum"));

        ccWhere.Clear();


        ccWhere.AddComponent("Order_ID", orderID, SearchComponent.Equals, SearchPad.NULL);
        servCommfac.strOrderString = "id";
        DataTable dtZhujian1 = servCommfac.ExecuteSqlDatatable("exec SPZhijian " + orderID + "," + ((iPageIndex - 1) * iCount + 1).ToString() + "," + (iPageIndex * iCount).ToString());

        string zhijiansql = "SELECT b.itemname as ProductName,a.Order_ID,a.itemQty,a.dept,a.producer,a.getin,isnull(a.Finish, a.PreTime) as finishTime,c.name as procedureName,isnull(itemQty, 0) as itemQty,productid,a.Gserial"
                            + ",case when a.Id = (select MIN(id) from[zhijian] zj where a.productid = zj.productid and zj.Order_ID = @oderID and zj.serial = 0 and zj.overflag <> 'F' ) then 'M' else  a.overflag end overflag,rtrim(a.a_teeth) + ',' + rtrim(a.b_teeth) + ',' + rtrim(a.c_teeth) + ',' + rtrim(a.d_teeth) as teethPosition, "
                            + " case when a.Upweb = 'Y' then '传完' else '未传' end Upweb,a_teeth, b_teeth, c_teeth, d_teeth FROM [zhijian] a inner join products b on a.productid = b.id inner join working_procedure c on a.Gserial = c.serial where a.Order_ID = '" + orderID + "' and a.serial = 0 order by ProductName,Gserial";
        DataTable dtZhujian = servCommfac.ExecuteSqlDatatable(zhijiansql);

        dtZhujian.TableName = "DataZhiJian";
        if (iPageCount <= 1 && dtZhujian.Rows.Count > 0)
        {
            int AllRowCount = int.Parse(dtZhujian.Rows[0]["AllRowCout"].ToString());
            iPageCount = ((AllRowCount - 1) / iCount) + 1;
            iPageIndex = 1;
        }

        string backstr = Json.DataTable2Json(dtZhujian, ",\"PageCount\":" + iPageCount.ToString());

        if (backstr.IndexOf("\\") >= 0)
        {
            backstr = backstr.Replace("\\", "\\\\");
        }

        Response.Write(backstr);
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
        string type = Request["actiontype"];

        if (type != null)
        {
            if (type == "SaveMainClass")
            {
                if (Request["DelMainClass"] != null && Request["DelClassID"] != null)
                {
                    servComm.ExecuteSql(" delete from Dict where MainClass = '" + Request["DelMainClass"] + "' and ClassID = '" + Request["DelClassID"] + "'");
                    servComm.ExecuteSql(" delete from DictDetail where ClassID = '" + Request["DelClassID"] + "'");
                }
                else
                {
                    string MainClass = Request["MainClass"];
                    string ClassID   = Request["ClassID"];
                    string ClassName = Request["ClassName"];
                    string Sortno    = Request["Sortno"];
                    try
                    {
                        if (!String.IsNullOrEmpty(ClassID))
                        {
                            ModelDict modelDict = new ModelDict();
                            modelDict.MainClass  = MainClass;
                            modelDict.ClassID    = ClassID;
                            modelDict.ClassName  = ClassName;
                            modelDict.Sortno     = int.Parse(Sortno);
                            modelDict.UpdateTime = DateTime.Now;
                            modelDict.UpdateUser = LoginUser.UserName;
                            if (servComm.ExecuteSqlDatatable("select ClassID from Dict where MainClass = '" + MainClass + "' and ClassID = '" + ClassID + "'").Rows.Count > 0)
                            {
                                ccWhere.AddComponent("MainClass", MainClass, SearchComponent.Equals, SearchPad.NULL);
                                ccWhere.AddComponent("ClassID", ClassID, SearchComponent.Equals, SearchPad.And);
                                servComm.Update(modelDict, ccWhere);
                            }
                            else
                            {
                                servComm.Add(modelDict);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write("-1");
                        Response.End();
                    }
                }
                servComm.strOrderString = "MainClass,Sortno";
                List <ModelDict> listObj = servComm.GetListTop <ModelDict>(0, "*", "Dict", null).ToList <ModelDict>();
                var timeConvert          = new IsoDateTimeConverter();
                timeConvert.DateTimeFormat = "yyyy-MM-dd";
                string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
                Response.Write(responseJson);
                Response.End();
            }
            else if (type == "GetMainClass")
            {
                servComm.strOrderString = "Sortno";
                List <ModelDict> listObj = servComm.GetListTop <ModelDict>(0, "*", "Dict", null).ToList <ModelDict>();
                var timeConvert          = new IsoDateTimeConverter();
                timeConvert.DateTimeFormat = "yyyy-MM-dd";
                string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
                Response.Write(responseJson);
                Response.End();
            }
            else if (type == "GetDetail")
            {
                servComm.strOrderString = "Sortno";
                ConditionComponent ccwhere = new ConditionComponent();
                ccwhere.AddComponent("ClassID", Request["selectMainClass"], SearchComponent.Equals, SearchPad.NULL);
                List <ModelDictDetail> listObj = servComm.GetListTop <ModelDictDetail>(0, "*", "DictDetail", ccwhere).ToList <ModelDictDetail>();
                var timeConvert = new IsoDateTimeConverter();
                timeConvert.DateTimeFormat = "yyyy-MM-dd";
                string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
                Response.Write(responseJson);
                Response.End();
            }
            else if (type == "SaveClass")
            {
                string jsonResult = Request["data"];
                List <ModelDictDetail> listModel = Utility.ConvertJsonToEntity <ModelDictDetail>(jsonResult.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries));
                string SelectClassID             = Request["selectMainClass"];
                servComm.ExecuteSql(" delete from DictDetail where ClassID = '" + SelectClassID + "'");
                foreach (ModelDictDetail model in listModel)
                {
                    if (!String.IsNullOrEmpty(model.Code))
                    {
                        model.ClassID  = SelectClassID;
                        model.OperTime = DateTime.Now;
                        model.oper     = LoginUser.UserName;
                        servComm.Add(model);
                    }
                }

                DataCache.dict = servComm.GetListTop <ModelDictDetail>(0, null).ToList();
                Response.Write("DictDetail");
                Response.End();
            }
        }
    }
示例#26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            listClassType = DataCache.findAllDict().Where(model => model.ClassID == "MaterialType").ToList();
            listClassType.Insert(0, new ModelDictDetail()
            {
            });

            servComm.strOrderString = "Client";
            ccWhere.Clear();
            ccWhere.AddComponent("Class", "A", SearchComponent.Equals, SearchPad.NULL);
            ccWhere.AddComponent("Class", "B", SearchComponent.Equals, SearchPad.Or);
            listSeler    = servComm.GetListTop <ModelClient>(0, ccWhere);
            listDictType = DataCache.findAllDict().Where(model => model.ClassID == "BillType").ToList();
            listDictType.Insert(0, new ModelDictDetail()
            {
            });
            servComm.strOrderString = " OrderNo ";
            ccWhere.Clear();
            ccWhere.AddComponent("OrderNo", null, SearchComponent.ISNOT, SearchPad.NULL);
            ccWhere.AddComponent("Bh", null, SearchComponent.ISNOT, SearchPad.And);
            IList <ModelSpec> listSaleDetail = servComm.GetListTop <ModelSpec>(0, "OrderNo,Bh", "Spec", ccWhere);
            string            SpecJson       = JsonConvert.SerializeObject(listSaleDetail, Formatting.Indented, new IsoDateTimeConverter());

            OrderJson = SpecJson.Replace("\r\n", "");
        }

        string Id = Request["Id"];

        if (!String.IsNullOrEmpty(Id))
        {
            servComm.strOrderString = "Id";
            ModelSale modelSale   = servComm.GetEntity <ModelSale>(Request["Id"]);
            var       timeConvert = new IsoDateTimeConverter();
            timeConvert.DateTimeFormat = "yyyy-MM-dd";
            string modelJson = JsonConvert.SerializeObject(modelSale, Formatting.Indented, timeConvert);
            ccWhere.Clear();
            ccWhere.AddComponent("Id", Id, SearchComponent.Equals, SearchPad.NULL);
            IList <ModelSaleDetail> listSaleDetail = servComm.GetListTop <ModelSaleDetail>(0, "*", "SaleDetail", ccWhere);

            string listJson = JsonConvert.SerializeObject(listSaleDetail, Formatting.Indented, timeConvert);

            EditJson = modelJson.Replace("}", ",\"DetailJson\":") + listJson + "}";
            EditJson = EditJson.Replace("\r\n", "");
            //"[{\"RowCount\":"+servComm.RowCount + ",\"JsonData\":"+ responseJson+"}]"
        }

        if (Request["actiontype"] == "SaveSales")
        {
            int identityID = 0;
            try
            {
                ModelSale modelSale = new ModelSale();

                DateTime?TimeNull = null;
                modelSale.SaleDate    = String.IsNullOrEmpty(Request["SaleDate"]) ? TimeNull : DateTime.Parse(Request["SaleDate"].ToString());
                modelSale.Seller      = Request["Seller"];
                modelSale.Salesperson = Request["Salesperson"];
                modelSale.BillDate    = String.IsNullOrEmpty(Request["BillDate"]) ? TimeNull : DateTime.Parse(Request["BillDate"].ToString());;
                modelSale.BillNo      = Request["BillNo"];
                modelSale.Addr        = Request["Addr"];
                modelSale.Receiver    = Request["Receiver"];
                modelSale.Tel         = Request["Tel"];
                modelSale.Distri      = Request["Distri"];
                modelSale.DistriNo    = Request["DistriNo"];
                modelSale.BillClass   = Request["BillClass"];
                modelSale.IsDel       = "0";
                modelSale.Reg         = LoginUser.UserName;
                modelSale.RegTime     = DateTime.Now;
                if (String.IsNullOrEmpty(Request["Id"]))
                {
                    identityID = servComm.Add(modelSale);
                }
                else
                {
                    identityID   = int.Parse(Request["Id"]);
                    modelSale.Id = identityID;
                    int result = servComm.Update(modelSale);
                }
                string jsonResult = Request["SalesDetail"];
                jsonResult = jsonResult.Replace("[", "").Replace("]", "").Replace("},{", "}|{").Replace("\"Id\":\"\"", "\"Id\":" + identityID.ToString());
                List <ModelSaleDetail> listModel = Utility.ConvertJsonToEntity <ModelSaleDetail>(jsonResult.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries));

                servComm.ExecuteSql(" delete from SaleDetail where ID = '" + identityID + "';");
                int serialIndex = 0;
                foreach (ModelSaleDetail modelDetail in listModel)
                {
                    serialIndex        = serialIndex + 1;
                    modelDetail.Serial = serialIndex;
                    servComm.Add(modelDetail);
                }

                if (String.IsNullOrEmpty(Request["Id"]))
                {
                    servComm.ExecuteSql("exec AutoDetectionNoCard " + identityID + "," + LoginUser.UserName);
                }
                else
                {
                    servComm.ExecuteSql("exec AutoDetectionNoCard " + identityID + "," + identityID);
                }
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write(identityID);
            Response.End();
        }
        else if (Request["actionType"] == "GetMaxCardNo")
        {
            DataTable dtCardNo = servComm.ExecuteSqlDatatable("select max(NoEnd) as MaxNo from CardNoMaintenance");
            if (dtCardNo.Rows.Count == 0)
            {
                Response.Write("00000000");
                Response.End();
            }
            else
            {
                string maxNo = dtCardNo.Rows[0][0].ToString();
                maxNo = (int.Parse(maxNo) + 1).ToString().PadLeft(8, '0');
                Response.Write(maxNo);
                Response.End();
            }
        }
        else if (Request["actionType"] == "DeleteCardNo")
        {
            string NoStart = Request["NoStart"];
            string NoEnd   = Request["NoEnd"];
            if (!String.IsNullOrEmpty(NoStart) && !String.IsNullOrEmpty(NoEnd))
            {
                servComm.ExecuteSql("update CardNoMaintenance set IsSave = 2 where  NoEnd ='" + NoEnd + "' and NoStart = '" + NoStart + "'");
            }
        }
        else if (Request["actiontype"] == "ValidCardNo")
        {
            string NoStart = Request["NoStart"];
            string NoEnd   = Request["NoEnd"];
            string Serial  = Request["Serial"];
            ccWhere.Clear();
            string condition = "";
            if (Serial != null && Serial == "-1")
            {
                Serial = Request["DetailCount"];
            }
            else if (Serial != null && Serial != "-1" && !String.IsNullOrEmpty(Id))
            {
                condition = condition + " and (ID !='" + Id + "' or  ID ='" + Id + "' and Serial != " + Serial + ")";
                //ccWhere.AddComponent("Id", Id, SearchComponent.Equals, SearchPad.NULL);
                //ccWhere.AddComponent("Serial", Serial, SearchComponent.UnEquals, SearchPad.And);
            }
            else
            {
                condition = condition + " and (ID !='" + LoginUser.UserName + "' or  ID ='" + LoginUser.UserName + "' and Serial != " + Serial + ")";
            }
            int count = servComm.ExecuteSqlDatatable("select Id from CardNoMaintenance where (NoStart<='" + NoStart + "' and NoEnd>='" + NoStart +
                                                     "' or NoStart<='" + NoEnd + "' and NoEnd>='" + NoEnd +
                                                     "' or NoStart>='" + NoStart + "' and NoEnd<='" + NoEnd + "')" + condition).Rows.Count;
            if (count == 0)
            {
                if (String.IsNullOrEmpty(Id))
                {
                    servComm.ExecuteSql("delete from CardNoMaintenance where  ID ='" + LoginUser.UserName + "' and Serial = " + Serial + ";  insert into CardNoMaintenance values('" + LoginUser.UserName + "','" + Serial + "','" + NoStart + "','" + NoEnd + "',GetDate(),0)");
                }
                else
                {
                    servComm.ExecuteSql("delete from CardNoMaintenance where  ID ='" + Id + "' and Serial = " + Serial + ";insert into CardNoMaintenance values('" + Id + "','" + Serial + "','" + NoStart + "','" + NoEnd + "',GetDate(),0)");
                }

                Response.Write(count);
                Response.End();
            }
        }
        //if (modelSale.ExecuteSqlDatatable("select ClassID from Dict where ClassID = '" + ClassID + "'").Rows.Count > 0)
        //{
        //    servComm.Update(modelDict);
        //}
        //else
        //{

        //}
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            servCommfac = new ServiceCommon(factoryConnectionString);
            if (!IsPostBack)
            {
                ((HtmlContainerControl)Master.FindControl("HTitle")).InnerText = IsCN? "订单输入":"Order Input";

                ddlOrderType.DataSource = BindDictClass(servCommfac, ccWhere, "OrderClass");
                ddlOrderType.DataBind();
            }
            timeStamp = TenpayUtil.getTimestamp();

            signalticket = GetSignalTicket(timeStamp, Session["APPID"].ToString(), Session["APPSECRET"].ToString());

            if (GetOrganization.Count > 0)
            {
                userSellerID = GetOrganization["sellerid"].ToString();;
            }
            if (GetOrganization.Count == 2)
            {
                userHospitalID = GetOrganization["hospitalid"].ToString();
            }
            else if (GetOrganization.Count == 3)
            {
                userHospitalID = GetOrganization["hospitalid"].ToString();
                userDoctorID   = GetOrganization["doctorid"].ToString();
            }


            GetSceneryTypeList();
            GetColors();
            GetDoctorRequire();
            if (Request["action"] == "autoNo")
            {
                DataTable dtNumber = servComm.ExecuteSqlDatatable("select dbo.fn_GetAutoOrderNo(N'" + LoginUser.UserName + "','" + DateTime.Now.ToString("yyMMdd") + "','" + LoginUser.BelongFactory + "')");
                if (dtNumber.Rows.Count > 0)
                {
                    Response.Write(dtNumber.Rows[0][0].ToString().Trim());
                    Response.End();
                }
                else
                {
                    Response.Write("");
                    Response.End();
                }
            }

            string serverImage   = Request["uploadimage"];
            string AccessoryList = Request["AccessoryList"];
            string path          = Server.MapPath("~" + SaveFilePath); //网站中有一个 uploadedFiles 文件夹,存储上传来的图片
            string photoList     = "";
            //生成文件名(系统要重新生成一个文件名,但注意扩展名要相同。千万不要用中文名称!!!)

            Log.LogInfo(serverImage);
            if (!String.IsNullOrEmpty(serverImage))
            {
                string file     = string.Empty;
                string content  = string.Empty;
                string strpath  = string.Empty;
                string savepath = string.Empty;
                for (int i = 0; i < serverImage.Split(',').Length; i++)
                {
                    string stUrl = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + GetAccessToken(Session["APPID"].ToString(), Session["APPSECRET"].ToString()) + "&media_id=" + serverImage.Split(',')[i];

                    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(stUrl);

                    req.Method = "GET";
                    using (WebResponse wr = req.GetResponse())
                    {
                        HttpWebResponse myResponse = (HttpWebResponse)req.GetResponse();

                        strpath = myResponse.ResponseUri.ToString();

                        WebClient mywebclient = new WebClient();
                        string    filename    = DateTime.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next().ToString().Substring(0, 4) + ".jpg";
                        savepath = path + "\\" + filename;

                        try
                        {
                            Log.LogInfo(savepath);
                            mywebclient.DownloadFile(strpath, savepath);
                            System.Drawing.Image img = System.Drawing.Image.FromFile(savepath);

                            if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png))
                            {
                                filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next().ToString().Substring(0, 4) + ".png";
                                img.Save(path + "\\" + filename);
                                file = Request.Url.GetLeftPart(UriPartial.Authority) + SaveFilePath + filename;
                            }
                            else
                            {
                                file = Request.Url.GetLeftPart(UriPartial.Authority) + SaveFilePath + filename;
                            }

                            photoList = photoList + "," + file;
                            Log.LogInfo(file);
                        }
                        catch (Exception ex)
                        {
                            Log.LogInfo(ex.Message);
                        }
                    }
                    photoList = photoList.Trim(',');
                }
            }

            if (yeyRequest.Params("haddinfo") == "1")
            {
                string seller   = Request["seller"];
                string hospital = Request["hospital"];
                string doctor   = Request["doctor"];
                string patient  = Request["patient"];
                ordreModel.ModelNo    = Request["txtModelNo"];
                ordreModel.OrderClass = ddlOrderType.Value;
                ordreModel.SellerID   = decimal.Parse(seller);
                ordreModel.HospitalID = decimal.Parse(hospital);
                ordreModel.DoctorId   = decimal.Parse(doctor);
                ordreModel.Patient    = Request["txtpatient"];
                if (Request["txtAge"] != "")
                {
                    ordreModel.Age = decimal.Parse(Request["txtAge"]);
                }
                ordreModel.Sex    = Request["ddlSex"];
                ordreModel.danzuo = Request["ddlSingle"];
                ordreModel.Fenge  = Request["ddlDivision"];
                if (!String.IsNullOrEmpty(Request["Require"]))
                {
                    ordreModel.Require = Request["Require"].Replace("'", "");
                }
                ordreModel.RegTime       = DateTime.Now;
                ordreModel.RegName       = LoginUser.UserName;
                ordreModel.BelongFactory = LoginUser.BelongFactory;
                if (!String.IsNullOrEmpty(yeyRequest.Params("keyID")))
                {
                    servComm.Update(ordreModel);
                }
                else
                {
                    servComm.Add(ordreModel);
                }


                //string AccessoryList = Request["OtherList"];
                if (AccessoryList != "")
                {
                    servComm.ExecuteSql(" delete from W_ordersOther where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'");
                    string[]     otherSplit = AccessoryList.Split(':');
                    WORDERSOTHER otherModel = new WORDERSOTHER();
                    ccWhere.Clear();
                    ccWhere.AddComponent("ClassID", "Accessory", SearchComponent.Equals, SearchPad.NULL);
                    DataTable dtAccessory = servCommfac.GetListTop(0, "DictDetail", ccWhere);
                    for (int i = 0; i < otherSplit.Length; i++)
                    {
                        string accessoryName = "";
                        if (dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'").Length > 0)
                        {
                            accessoryName = dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'")[0]["DictName"].ToString();
                        }
                        otherModel.ModelNo       = Request["txtModelNo"];
                        otherModel.SubId         = i + 1;
                        otherModel.Code          = otherSplit[i].Split(',')[0];
                        otherModel.name          = accessoryName;
                        otherModel.qty           = decimal.Parse(otherSplit[i].Split(',')[1]);
                        otherModel.BelongFactory = LoginUser.BelongFactory;
                        servComm.Add(otherModel);
                    }
                }

                if (photoList != "")
                {
                    servComm.ExecuteSql(" delete from W_OrderPhotos where ModelNo='" + Request["txtModelNo"] + "' and BelongFactory = '" + LoginUser.BelongFactory + "'");
                    string[]      photoSplit = photoList.Split(',');
                    WORDERSPHOTOS photoModel = new WORDERSPHOTOS();
                    for (int i = 0; i < photoSplit.Length; i++)
                    {
                        photoModel.ModelNo       = Request["txtModelNo"];
                        photoModel.SubId         = i + 1;
                        photoModel.picpath       = photoSplit[i];
                        photoModel.BelongFactory = LoginUser.BelongFactory;
                        servComm.Add(photoModel);
                    }
                }

                string[] ddlSmallClass = Request["ddlSmallClass"].Split(',');
                string[] ddlItemName   = Request["ddlItemName"].Split(',');
                string[] righttop      = Request["righttop"].Split(',');
                string[] lefttop       = Request["lefttop"].Split(',');
                string[] rightbottom   = Request["rightbottom"].Split(',');
                string[] leftbottom    = Request["leftbottom"].Split(',');
                string[] ProductColor  = Request["hidProductColor"].Split(',');
                string[] ProductCount  = Request["ProductCount"].Split(',');

                servComm.ExecuteSql(" delete from W_OrdersDetail where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'");
                int index = 1;
                for (int i = 0; i < ddlSmallClass.Length; i++)
                {
                    WORDERSDETAIL detailMode = new WORDERSDETAIL();
                    detailMode.a_teeth       = righttop[i];
                    detailMode.b_teeth       = lefttop[i];
                    detailMode.c_teeth       = rightbottom[i];
                    detailMode.d_teeth       = leftbottom[i];
                    detailMode.ProductId     = ddlItemName[i];
                    detailMode.bColor        = ProductColor[i].Replace(":", ",");
                    detailMode.Qty           = int.Parse(ProductCount[i]);
                    detailMode.subId         = index;
                    detailMode.ModelNo       = Request["txtModelNo"];
                    detailMode.BelongFactory = LoginUser.BelongFactory;
                    servComm.Add(detailMode);
                    index = index + 1;
                }

                Response.Redirect("OrderInput.aspx");
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request["customertype"]))
        {
            CustomerType = Request["customertype"];
        }
        string actiontype = Request["actiontype"];

        if (actiontype == "GetCustomerManageList")
        {
            string Serial = Request["Serial"];
            ccwhere.AddComponent("Class", "S", SearchComponent.UnEquals, SearchPad.And);
            if (!String.IsNullOrEmpty(Serial))
            {
                ccwhere.AddComponent("Serial", "%" + Serial + "%", SearchComponent.Like, SearchPad.And);
            }
            string Class = Request["Class"];
            if (!String.IsNullOrEmpty(Class))
            {
                ccwhere.AddComponent("Class", "%" + Class + "%", SearchComponent.Like, SearchPad.And);
            }

            string Client = Request["Client"];
            if (!String.IsNullOrEmpty(Client))
            {
                ccwhere.AddComponent("Client", "%" + Client + "%", SearchComponent.Like, SearchPad.And);
            }

            string linkman = Request["linkman"];
            if (!String.IsNullOrEmpty(linkman))
            {
                ccwhere.AddComponent("linkman", "%" + linkman + "%", SearchComponent.Like, SearchPad.And);
            }

            int iPageCount = 0;
            int iPageIndex = int.Parse(Request["PageIndex"]) + 1;
            servComm.strOrderString = "Id desc";
            listObj = servComm.GetList <ModelClient>("Client", "*", "Id", 10, iPageIndex, iPageCount, ccwhere);

            var timeConvert = new IsoDateTimeConverter();
            //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConvert.DateTimeFormat = "yyyy-MM-dd";
            string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
            Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]");
            Response.End();
        }
        else if (actiontype == "ExportExcel")
        {
            string BillNo = Request["BillNo"];
            if (!String.IsNullOrEmpty(BillNo))
            {
                ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And);
            }
            string Salesperson = Request["Salesperson"];
            if (!String.IsNullOrEmpty(Salesperson))
            {
                ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And);
            }
            string IsDel = Request["IsDel"];
            if (!String.IsNullOrEmpty(IsDel))
            {
                ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And);
            }
            else
            {
                ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And);
            }

            servComm.strOrderString = "Id";
            listObj = servComm.GetListTop <ModelClient>(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere);
            string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx";
            string fileName  = Request.PhysicalApplicationPath + "UploadFile\\" + shortName;
            using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\"))
            {
                DataTable dtTable = listObj.ToDataTable();
                dtTable.Columns.Remove("IsDel");
                int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true);
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            Response.End();
        }
        else if (Request["actiontype"] == "SaveCustomer")
        {
            int identityID = 0;
            try
            {
                ModelClient modelClient = new ModelClient();
                if (String.IsNullOrEmpty(Request["Id"]))
                {
                    modelClient.Class    = Request["Class"];
                    modelClient.Serial   = Request["Serial"];
                    modelClient.Client   = Request["Client"];
                    modelClient.linkman  = Request["linkman"];
                    modelClient.Tel      = Request["Tel"];
                    modelClient.Tel2     = Request["Tel2"];
                    modelClient.Country  = Request["Country"];
                    modelClient.Province = Request["Province"];
                    modelClient.City     = Request["City"];
                    modelClient.Email    = Request["Email"];
                    modelClient.Addr     = Request["Addr"];
                    modelClient.UserName = Request["UserName"];

                    if (servComm.ExecuteSqlDatatable("select ID from Client where UserName ='******'").Rows.Count > 0)
                    {
                        identityID = -1;
                    }
                    else
                    {
                        string password = CryptoHelper.StaticEncrypt("1");
                        //}
                        modelClient.Passwd = password;
                        identityID         = servComm.Add(modelClient);
                    }
                    //string password = Request["Passwd"];
                    //if (!String.IsNullOrEmpty(password))
                    //{
                }
                else
                {
                    if (String.IsNullOrEmpty(Request["Class"]))
                    {
                        identityID = servComm.ExecuteSql(" delete from Client where ID in (" + Request["Id"] + ");");
                    }
                    else
                    {
                        identityID           = int.Parse(Request["Id"]);
                        modelClient.Class    = Request["Class"];
                        modelClient.Serial   = Request["Serial"];
                        modelClient.Client   = Request["Client"];
                        modelClient.linkman  = Request["linkman"];
                        modelClient.Tel      = Request["Tel"];
                        modelClient.Tel2     = Request["Tel2"];
                        modelClient.Country  = Request["Country"];
                        modelClient.Province = Request["Province"];
                        modelClient.City     = Request["City"];
                        modelClient.Email    = Request["Email"];
                        modelClient.Addr     = Request["Addr"];
                        modelClient.UserName = Request["UserName"];

                        if (servComm.ExecuteSqlDatatable("select ID from Client where UserName ='******' and ID !=" + identityID).Rows.Count > 0)
                        {
                            identityID = -1;
                        }
                        else
                        {
                            string password = Request["Passwd"];
                            if (!String.IsNullOrEmpty(password))
                            {
                                password = CryptoHelper.StaticEncrypt("1");
                            }
                            modelClient.Passwd = password;
                            modelClient.ID     = identityID;
                            int result = servComm.Update(modelClient);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write(identityID);
            Response.End();
        }
    }
示例#29
0
    private void BindComfirmdeListReport(bool initFlg = false)
    {
        if (initFlg)
        {
            this.ConfirmDeList.Visible = false;
        }
        else
        {
            this.ConfirmDeList.Visible = true;
            this.ConfirmDeList.LocalReport.DataSources.Clear();
            string HospitalList = Request["HospitalList"];
            string dateselect   = Request["dateselect"];
            ccWhere.Clear();
            ccWhere.AddComponent("sellerid", this.seller.SelectedValue, SearchComponent.Equals, SearchPad.NULL);
            if (!String.IsNullOrEmpty(HospitalList))
            {
                ccWhere.AddComponent("hospitalid", "(" + HospitalList.Replace(":", ",") + ")", SearchComponent.In, SearchPad.And);
            }
            if (!String.IsNullOrEmpty(dateselect))
            {
                if (dateselect == "0")
                {
                    ccWhere.AddComponent("indate", ConvertShortDate(Request["txtdatefrom"]), SearchComponent.GreaterOrEquals, SearchPad.And);
                    ccWhere.AddComponent("indate", ConvertShortDate(Request["txtdateto"]), SearchComponent.LessOrEquals, SearchPad.And);
                }
                else if (dateselect == "1")
                {
                    ccWhere.AddComponent("outdate", ConvertShortDate(Request["txtdatefrom"]), SearchComponent.GreaterOrEquals, SearchPad.And);
                    ccWhere.AddComponent("outdate", ConvertShortDate(Request["txtdateto"]), SearchComponent.LessOrEquals, SearchPad.And);
                }
                else
                {
                    ccWhere.AddComponent("preoutdate", Request["txtpredate"], SearchComponent.Equals, SearchPad.And);
                }
            }

            if (!String.IsNullOrEmpty(this.CaseNo.Text))
            {
                ccWhere.AddComponent("ModelNo", this.CaseNo.Text, SearchComponent.Like, SearchPad.And);
            }

            string charges    = "";
            string orderClass = "";

            for (int i = 0; i < this.charges.Items.Count; i++)
            {
                if (this.charges.Items[i].Selected == true)
                {
                    charges = charges + ",'" + this.charges.Items[i].Value + "'";
                }
            }
            if (!String.IsNullOrEmpty(charges))
            {
                charges = "(" + charges.Trim(',') + ")";
                ccWhere.AddComponent("charges", charges, SearchComponent.In, SearchPad.And);
            }

            for (int i = 0; i < this.orderType.Items.Count; i++)
            {
                if (this.orderType.Items[i].Selected == true)
                {
                    orderClass = orderClass + ",'" + this.orderType.Items[i].Value + "'";
                }
            }
            if (!String.IsNullOrEmpty(orderClass))
            {
                orderClass = "(" + orderClass.Trim(',') + ")";
                ccWhere.AddComponent("orderclasscode", orderClass, SearchComponent.In, SearchPad.And);
            }



            GetFilterByKind(ref ccWhere, "Report");
            //DataTable dtModelProcessing = facservComm.ExecuteSqlDatatable("select * from VWConfirmDeList");
            DataTable dtConfirmDeList = facservComm.ExecuteSqlDatatable(ConfirmDeList + " where " + ccWhere.sbComponent);

            // DataTable dtConfirmDeList = facservComm.GetListTop(0, "* ", "VWConfirmDeList", ccWhere);
            this.ConfirmDeList.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtConfirmDeList));
            this.ConfirmDeList.DataBind();
            this.ConfirmDeList.LocalReport.Refresh();
            //}
        }
    }
示例#30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            listClassType = DataCache.findAllDict().Where(model => model.ClassID == "MaterialType").ToList();
            listClassType.Insert(0, new ModelDictDetail()
            {
            });
        }
        string actiontype = Request["actiontype"];

        if (actiontype == "GetSpecManageList")
        {
            string Bh = Request["Bh"];
            if (!String.IsNullOrEmpty(Bh))
            {
                ccwhere.AddComponent("Bh", "%" + Bh + "%", SearchComponent.Like, SearchPad.And);
            }
            string Class = Request["Class"];
            if (!String.IsNullOrEmpty(Class))
            {
                ccwhere.AddComponent("Class", Class, SearchComponent.Equals, SearchPad.And);
            }
            string OrderNo = Request["OrderNo"];
            if (!String.IsNullOrEmpty(OrderNo))
            {
                ccwhere.AddComponent("OrderNo", "%" + OrderNo + "%", SearchComponent.Like, SearchPad.And);
            }



            int iPageCount = 0;
            int iPageIndex = int.Parse(Request["PageIndex"]) + 1;
            servComm.strOrderString = "Id desc ";
            listObj = servComm.GetList <ModelSpec>("Spec", "*", "Id", 10, iPageIndex, iPageCount, ccwhere);
            listObj.ToList().ForEach(eo => eo.Class = (listClassType.Where(le => le.Code == eo.Class).Count() > 0 ? listClassType.Where(le => le.Code == eo.Class).FirstOrDefault().DictName : ""));


            var timeConvert = new IsoDateTimeConverter();
            //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConvert.DateTimeFormat = "yyyy-MM-dd";


            string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert);
            responseJson = responseJson.Replace(": null", ": \"\"");
            Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]");
            Response.End();
        }
        else if (actiontype == "ExportExcel")
        {
            string BillNo = Request["BillNo"];
            if (!String.IsNullOrEmpty(BillNo))
            {
                ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And);
            }
            string Salesperson = Request["Salesperson"];
            if (!String.IsNullOrEmpty(Salesperson))
            {
                ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And);
            }
            string IsDel = Request["IsDel"];
            if (!String.IsNullOrEmpty(IsDel))
            {
                ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And);
            }
            else
            {
                ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And);
            }

            servComm.strOrderString = "Id";
            listObj = servComm.GetListTop <ModelSpec>(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere);
            string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx";
            string fileName  = Request.PhysicalApplicationPath + "UploadFile\\" + shortName;
            using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\"))
            {
                DataTable dtTable = listObj.ToDataTable();
                dtTable.Columns.Remove("IsDel");
                int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true);
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            Response.End();
        }
        else if (Request["actiontype"] == "SaveSpec")
        {
            int identityID = 0;
            try
            {
                ModelSpec ModelSpec = new ModelSpec();
                if (String.IsNullOrEmpty(Request["Id"]))
                {
                    ModelSpec.Class       = Request["Class"];
                    ModelSpec.Bh          = Request["Bh"];
                    ModelSpec.ProductName = Request["ProductName"];
                    ModelSpec.Spec        = Request["Spec"];
                    ModelSpec.OrderNo     = Request["OrderNo"];
                    ModelSpec.Size        = Request["Size"];
                    ModelSpec.exterior    = Request["exterior"];
                    ModelSpec.Color       = Request["Color"];
                    ModelSpec.Remark      = Request["Remark"];
                    identityID            = servComm.Add(ModelSpec);
                }
                else
                {
                    if (String.IsNullOrEmpty(Request["Bh"]))
                    {
                        identityID = servComm.ExecuteSql(" delete from Spec where ID in (" + Request["Id"] + ");");
                    }
                    else
                    {
                        identityID            = int.Parse(Request["Id"]);
                        ModelSpec.Class       = Request["Class"];
                        ModelSpec.Bh          = Request["Bh"];
                        ModelSpec.ProductName = Request["ProductName"];
                        ModelSpec.Spec        = Request["Spec"];
                        ModelSpec.OrderNo     = Request["OrderNo"];
                        ModelSpec.Size        = Request["Size"];
                        ModelSpec.exterior    = Request["exterior"];
                        ModelSpec.Color       = Request["Color"];
                        ModelSpec.Remark      = Request["Remark"];
                        ModelSpec.ID          = identityID;
                        int result = servComm.Update(ModelSpec);
                    }
                }
                DataCache.dict = servComm.GetListTop <ModelDictDetail>(0, null).ToList();
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write(identityID);
            Response.End();
        }
    }