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();
        }
    }
Exemplo n.º 2
0
    static DataCache()
    {
        ServiceCommon servComm = new ServiceCommon();

        dict     = servComm.GetListTop <ModelDictDetail>(0, null).ToList();
        dictSpec = servComm.GetListTop <ModelSpec>(0, null).ToList();
    }
    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);
        }
    }
Exemplo n.º 4
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";
        }
    }
    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);
        }
    }
Exemplo n.º 6
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();
    }
    /// <summary>
    /// 绑定业务员
    /// </summary>
    private void BindSeller()
    {
        //调用Bll层方法,返回流程分组数据
        DataTable dtSeller = facComm.GetListTop(0, " id,Seller ", "seller", null);

        ddlSeller.DataSource     = dtSeller;
        ddlSeller.DataValueField = "ID";
        ddlSeller.DataTextField  = "Seller";
        ddlSeller.DataBind();
        if (IsCN)
        {
            ddlSeller.Items.Insert(0, new ListItem("全部", "-1"));
        }
        else
        {
            ddlSeller.Items.Insert(0, new ListItem("All", "-1"));
        }

        if (GetOrganization.Count > 0)
        {
            this.ddlSeller.SelectedValue = GetOrganization["sellerid"].ToString();
            this.ddlSeller.Enabled       = false;
        }
        if (GetOrganization.Count == 2)
        {
            userHospitalID = GetOrganization["hospitalid"].ToString();
        }
        else if (GetOrganization.Count == 3)
        {
            userHospitalID = GetOrganization["hospitalid"].ToString();
            userDoctorID   = GetOrganization["doctorid"].ToString();
        }
    }
Exemplo n.º 8
0
    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();
            //}
        }
    }
Exemplo n.º 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);
 }
Exemplo n.º 10
0
    /// <summary>
    /// 绑定业务员
    /// </summary>
    private void BindSeller()
    {
        //调用Bll层方法,返回流程分组数据
        DataTable dtSeller = facComm.GetListTop(0, " id,Seller ", "seller", null);

        ddlSeller.DataSource     = dtSeller;
        ddlSeller.DataValueField = "ID";
        ddlSeller.DataTextField  = "Seller";
        ddlSeller.DataBind();

        ddlSeller.Items.Insert(0, new ListItem("全部", "-1"));
    }
Exemplo n.º 11
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"];
            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) {
        }
    }
Exemplo n.º 12
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 string GetSeller(object sllerID)
    {
        if (sllerID == null)
        {
            return("");
        }
        ServiceCommon facComm = new ServiceCommon(factoryConnectionString);

        ccWhere.Clear();
        ccWhere.AddComponent("id", sllerID.ToString(), SearchComponent.Equals, SearchPad.NULL);
        DataTable dt = facComm.GetListTop(0, " Seller ", "seller", ccWhere);

        if (dt.Rows.Count > 0)
        {
            return(dt.Rows[0]["Seller"].ToString());
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 14
0
    protected string GetProductName(object productID)
    {
        if (productID == null)
        {
            return("");
        }
        ServiceCommon facComm = new ServiceCommon(factoryConnectionString);

        ccWhere.Clear();
        ccWhere.AddComponent("id", productID.ToString(), SearchComponent.Equals, SearchPad.NULL);
        DataTable dt = facComm.GetListTop(0, " itemname,SmallClass ", "products", ccWhere);

        if (dt.Rows.Count > 0)
        {
            return(dt.Rows[0]["itemname"].ToString() + "," + dt.Rows[0]["SmallClass"].ToString());
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 15
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)
    {
        string actiontype = Request["actiontype"];

        if (actiontype == "GetSaleList")
        {
            ConstructionCondition();

            int iPageCount = 0;
            int iPageIndex = int.Parse(Request["PageIndex"]) + 1;
            servComm.strOrderString = "CardNo";
            listObj = servComm.GetList <ModelOrders>("orders", "*", "CardNo", 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")
        {
            ConstructionCondition();

            servComm.strOrderString = "CardNo";
            listObj = servComm.GetListTop <ModelOrders>(0, "*", "orders", 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();
                int       count   = excelHelper.DataTableToExcel(dtTable, "工厂订单信息", true, "工厂订单信息.xlsx");
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            Response.End();
        }
    }
Exemplo n.º 17
0
    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 = '******'");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ModelBase modelSale   = servComm.GetEntity <ModelBase>("1");
            var       timeConvert = new IsoDateTimeConverter();
            timeConvert.DateTimeFormat = "yyyy-MM-dd";
            string modelJson = JsonConvert.SerializeObject(modelSale, Formatting.Indented, timeConvert);

            EditJson = modelJson.Replace("\r\n", "");
        }
        string actiontype = Request["actiontype"];

        if (actiontype == "GetProductList")
        {
            servComm.strOrderString = "itemname collate Chinese_PRC_CS_AS_KS_WS";
            // ccWhere.AddComponent("Serial", LoginUser.Serial, SearchComponent.Equals, SearchPad.NULL);
            DataTable dtProduct   = servComm.GetListTop(0, "products", ccWhere);
            var       timeConvert = new IsoDateTimeConverter();
            //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            timeConvert.DateTimeFormat = "yyyy-MM-dd";
            string responseJson = JsonConvert.SerializeObject(dtProduct, Formatting.Indented, timeConvert);
            Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]");
            Response.End();
        }
        else if (actiontype == "SaveBase")
        {
            int identityID = 1;
            try
            {
                ModelBase modelBase = new ModelBase();

                modelBase.ID        = 1;
                modelBase.corp      = Request["corp"].ToString();
                modelBase.Ecorp     = Request["Ecorp"].ToString();
                modelBase.Address   = Request["Address"];
                modelBase.Email     = Request["Email"];
                modelBase.fax       = Request["fax"];
                modelBase.LinkMan   = Request["LinkMan"];
                modelBase.netname   = Request["netname"];
                modelBase.phone     = Request["phone"];
                modelBase.ServerIP  = Request["ServerIP"];
                modelBase.ProductID = Request["ProductID"];
                modelBase.RoleA     = Request["RoleA"].Trim(':');
                modelBase.RoleB     = Request["RoleB"].Trim(':');
                modelBase.RoleC     = Request["RoleC"].Trim(':');
                modelBase.RoleD     = Request["RoleD"].Trim(':');
                servComm.Delete <ModelBase>("1", true);

                servComm.Add(modelBase);
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write(identityID);
            Response.End();
        }
        else if (actiontype == "DeleteHisData")
        {
            try
            {
                string factoryEndDate = Request["factoryEndDate"];
                string salesEndDate   = Request["salesEndDate"];
                servComm.ExecuteSql("exec SP_DeleteHistory '" + factoryEndDate + "','" + salesEndDate + "'");
            }
            catch (Exception ex)
            {
                Response.Write(0);
                Response.End();
            }

            Response.Write("1");
            Response.End();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["action"] == "CompareTalkRecord")
        {
            string unReadOrderNo = "";
            if (Session["allOrder"] == null)
            {
                Response.Write("");
                Response.End();
            }
            else
            {
                string[] orderNumber = Session["allOrder"].ToString().Trim(',').Split(',');
                for (int i = 0; i < orderNumber.Length; i++)
                {
                    if (Request.Cookies[LoginUser.BelongFactory + orderNumber[i]] != null && Request.Cookies[LoginUser.BelongFactory + orderNumber[i]].Value != "")
                    {
                        unReadOrderNo = GetLastedTimeByOrder(unReadOrderNo, orderNumber[i]);
                    }
                    else
                    {
                        unReadOrderNo = unReadOrderNo + "," + orderNumber[i];
                    }
                }
                Response.Write(unReadOrderNo.Trim(','));
                Response.End();
            }
        }

        if (Request["action"] == "ReadTalkRecord")
        {
            string orderNumber = Request["orderNumber"];
            string modifyDate  = GetLastedTimeByOrder("", orderNumber, "1");
            Response.Write(modifyDate);
            Response.End();
        }

        if (!IsPostBack)
        {
        }
        if (!string.IsNullOrEmpty(Request["hDelete"]))
        {
            servComm.ExecuteSql(" delete from W_Orders where ModelNo='" + Request["hDelete"] + "' and BelongFactory='" + LoginUser.BelongFactory + "'");
        }

        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 txtModelNumber = Request["txtModelNumber"];

        if (!string.IsNullOrEmpty(txtModelNumber))
        {
            ccWhere.AddComponent("ModelNo ", "%" + txtModelNumber + "%", 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);
                ccMessageWhere.AddComponent("sellerid ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
            else if (selectedLevel == "1")
            {
                ccWhere.AddComponent("HospitalID ", selectedID, SearchComponent.Equals, SearchPad.And);
                ccMessageWhere.AddComponent("HospitalID ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
            else if (selectedLevel == "2")
            {
                ccWhere.AddComponent("DoctorID ", selectedID, SearchComponent.Equals, SearchPad.And);
                ccMessageWhere.AddComponent("DoctorID ", selectedID, SearchComponent.Equals, SearchPad.And);
            }
        }

        //被接收的订单不展示
        //ccWhere.AddComponent("isnull(Auth,'0') ", "0", SearchComponent.Equals, SearchPad.And);

        GetFilterByKind(ref ccWhere);
        GetFilterByKind(ref ccMessageWhere);

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

        ccMessageWhere.AddComponent("ModelNo", "(select OrderNumber from OrderMessage )", SearchComponent.In, SearchPad.And);
        IList <WORDERS> alllist    = servComm.GetListTop <WORDERS>(0, ccMessageWhere);
        string          strModelNo = "";

        alllist.ToList().ForEach(item => strModelNo = strModelNo + "," + item.ModelNo);
        Session["allOrder"]          = strModelNo;
        this.repOrderList.DataSource = ilist;
        repOrderList.DataBind();
        pagecut1.iPageNum = servComm.PageCount;
    }
Exemplo n.º 20
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();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ccwhere.Clear();
            ccwhere.AddComponent("Class", "B", SearchComponent.Equals, SearchPad.NULL);
            listSeler   = servComm.GetListTop <ModelClient>(0, "*", "Client", ccwhere);
            BindingJson = JsonConvert.SerializeObject(listSeler, Formatting.Indented, new IsoDateTimeConverter());

            BindingJson = BindingJson.Replace("\r\n", "").Replace("Client", "NodeName");
        }
        string actiontype = Request["actiontype"];

        if (actiontype == "GetSaleList")
        {
            ConstructionCondition();

            int iPageCount = 0;
            int iPageIndex = int.Parse(Request["PageIndex"]) + 1;
            servComm.strOrderString = "CardNo";
            listObj = servComm.GetList <ModeRelatedOrderView>("ViewRelatedOrder", "*", "CardNo", 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")
        {
            ConstructionCondition();

            servComm.strOrderString = "CardNo";
            listObj = servComm.GetListTop <ModeRelatedOrderView>(0, "[CardNo],[factoryBM],[Order_ID],[hospital],[doctor],[patient],[OutDate],[factoryValid],[a_teeth],[b_teeth],[c_teeth],[d_teeth],[Itemname],[Id],[Serial],[Bh],[orderid],[Qty],[OClass],[ObatchNo],[BatchNo],[ProdDate],[TestDate],[BtQty],[SRate],[Valid],[Addr],[receiver],[Tel],[distri],[distriNo],[NoStart],[NoEnd],[NoQty],[BillClass],[seller],[Salesperson]", "ViewRelatedOrder", ccwhere);
            string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx";
            string fileName  = Request.PhysicalApplicationPath + "UploadFile\\" + shortName;
            using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\"))
            {
                DataTable dt = new DataTable();

                dt.Columns.Add("SaleDate");
                dt.Columns.Add("seller");
                dt.Columns.Add("Salesperson");
                dt.Columns.Add("BillDate");
                dt.Columns.Add("BillNo");
                dt.Columns.Add("BillClass");
                dt.Columns.Add("Qty");
                dt.Columns.Add("Bh");
                dt.Columns.Add("ProductName");
                dt.Columns.Add("orderid");
                dt.Columns.Add("BatchNo");
                dt.Columns.Add("OClass");
                dt.Columns.Add("ObatchNo");
                dt.Columns.Add("ProdDate");
                dt.Columns.Add("BtQty");
                dt.Columns.Add("SRate");
                dt.Columns.Add("Valid");
                dt.Columns.Add("receiver");
                dt.Columns.Add("Addr");
                dt.Columns.Add("Tel");
                dt.Columns.Add("distri");
                dt.Columns.Add("distriNo");
                dt.Columns.Add("NoStart");
                dt.Columns.Add("NoEnd");
                dt.Columns.Add("NoQty");
                dt.Columns.Add("factoryBM");
                dt.Columns.Add("Order_ID");
                dt.Columns.Add("hospital");
                dt.Columns.Add("doctor");
                dt.Columns.Add("patient");
                dt.Columns.Add("OutDate");
                dt.Columns.Add("Itemname");
                dt.Columns.Add("factoryValid");
                dt.Columns.Add("a_teeth");
                dt.Columns.Add("b_teeth");
                dt.Columns.Add("c_teeth");
                dt.Columns.Add("d_teeth");

                string templateName = "订单关联信息.xlsx";
                if (LoginUser.Class == "A")
                {
                    templateName = "订单关联信息A.xlsx";
                    dt.Columns.Remove("SaleDate");
                    dt.Columns.Remove("Salesperson");
                    dt.Columns.Remove("BillDate");
                    dt.Columns.Remove("BillNo");
                    dt.Columns.Remove("BillClass");
                    dt.Columns.Remove("Bh");
                    dt.Columns.Remove("OClass");
                    dt.Columns.Remove("ObatchNo");
                    dt.Columns.Remove("BtQty");
                    dt.Columns.Remove("distri");
                    dt.Columns.Remove("NoStart");
                    dt.Columns.Remove("NoEnd");

                    dt.Columns.Remove("factoryBM");
                    dt.Columns.Remove("Order_ID");
                    dt.Columns.Remove("hospital");
                    dt.Columns.Remove("doctor");
                    dt.Columns.Remove("patient");
                    dt.Columns.Remove("OutDate");
                    dt.Columns.Remove("Itemname");
                    dt.Columns.Remove("factoryValid");
                    dt.Columns.Remove("a_teeth");
                    dt.Columns.Remove("b_teeth");
                    dt.Columns.Remove("c_teeth");
                    dt.Columns.Remove("d_teeth");
                }
                else if (LoginUser.Class == "B")
                {
                    templateName = "订单关联信息B.xlsx";
                    dt.Columns.Remove("SaleDate");
                    dt.Columns.Remove("Salesperson");
                    dt.Columns.Remove("BillDate");
                    dt.Columns.Remove("BillNo");
                    dt.Columns.Remove("BillClass");
                    dt.Columns.Remove("Bh");
                    dt.Columns.Remove("OClass");
                    dt.Columns.Remove("ObatchNo");
                    dt.Columns.Remove("BtQty");
                    dt.Columns.Remove("distri");
                    dt.Columns.Remove("NoStart");
                    dt.Columns.Remove("NoEnd");
                }

                DataTable dtTable = listObj.ToDataTable(dt);
                int       count   = excelHelper.DataTableToExcel(dtTable, "订单关联信息", true, templateName);
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            Response.End();
        }
    }
Exemplo n.º 22
0
 /// <summary>
 /// 绑定分类
 /// </summary>
 protected DataTable BindDictClass(ServiceCommon facComm, ConditionComponent ccWhere, string ClassID)
 {
     ccWhere.Clear();
     ccWhere.AddComponent("ClassID", ClassID, SearchComponent.Equals, SearchPad.NULL);
     return(facComm.GetListTop(0, " Code,DictName ", "DictDetail", ccWhere));
 }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        factoryConnectionString            = ConfigurationManager.AppSettings["FactoryConnectString"];
        Session["factoryConnectionString"] = factoryConnectionString;
        facComm = new ServiceCommon(factoryConnectionString);
        if (!IsPostBack)
        {
            if (Request["action"] == null)
            {
                Session["productList"] = null;
            }
        }
        if (Request["action"] == "autoNo")
        {
            Response.Write("");
            Response.End();
        }


        if (Request["action"] == "checkUnique")
        {
            Response.Write("0");

            Response.End();
        }

        if (Request["action"] == "GetRequireTemplate")
        {
            string temlplate = Request["temlplate"];
            if (String.IsNullOrEmpty(temlplate))
            {
                Response.Write("");
            }
            else
            {
                DataTable dtRequire = servComm.ExecuteSqlDatatable("select RequireTemplateContent from W_RequireTemplate where id =" + temlplate);
                if (dtRequire.Rows.Count > 0)
                {
                    Response.Write(dtRequire.Rows[0][0].ToString());
                }
                else
                {
                    Response.Write("");
                }
            }
            Response.End();
        }

        BindRequireTemplate();
        BindSeller();

        if (String.IsNullOrEmpty(yeyRequest.Params("haddinfo")) && !String.IsNullOrEmpty(Request["ModelNo"]))
        {
            autoOrderNo.Visible = false;
            autoLable.Visible   = false;
            ccWhere.Clear();
            ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL);
            ordreModel = servComm.GetListTop <WORDERS>(1, ccWhere)[0];

            if (ordreModel.SellerID != 0)
            {
                this.ddlSeller.SelectedValue = ordreModel.SellerID.ToString();
            }

            ddlOrderType.Value = ordreModel.OrderClass;
            //strOtherList
            ccWhere.Clear();
            ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL);
            IList <WORDERSOTHER> listOther = servComm.GetListTop <WORDERSOTHER>(0, ccWhere);
            foreach (WORDERSOTHER item in listOther)
            {
                strOtherList = strOtherList + ":" + item.Code + "," + item.qty;
            }
            if (strOtherList != "")
            {
                strOtherList = strOtherList.Substring(1);
            }
            servComm.strOrderString = " subId asc ";
            List <WORDERSDETAIL> listOrders = (List <WORDERSDETAIL>)servComm.GetListTop <WORDERSDETAIL>(0, "*", ccWhere);
            foreach (WORDERSDETAIL item in listOrders)
            {
                string strValue = GetProductName(item.ProductId);
                if (strValue != "")
                {
                    item.ItemName   = strValue.Split(',')[0];
                    item.SmallClass = strValue.Split(',')[1];
                }
            }
            this.repProductList.DataSource = listOrders;
            this.repProductList.DataBind();
            Session["productList"]  = listOrders;
            servComm.strOrderString = "";
            ccWhere.Clear();
            ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL);
            IList <WORDERSPHOTOS> listPhotos = servComm.GetListTop <WORDERSPHOTOS>(0, ccWhere);
            foreach (WORDERSPHOTOS item in listPhotos)
            {
                strPhotoList = strPhotoList + "," + item.picpath;
            }
            if (strPhotoList != "")
            {
                strPhotoList = strPhotoList.Substring(1);
            }
        }

        if (yeyRequest.Params("haddinfo") == "1")
        {
            ordreModel.ModelNo    = Request["txtModelNo"];
            ordreModel.OrderClass = Request[this.ddlOrderType.UniqueID];
            ordreModel.SellerID   = decimal.Parse(Request[this.ddlSeller.UniqueID]);
            ordreModel.HospitalID = decimal.Parse(Request[this.ddlHosipital.UniqueID]);
            ordreModel.DoctorId   = decimal.Parse(Request[this.ddlDoctor.UniqueID]);
            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"];
            ordreModel.Require = Request["Require"].Replace("'", "");
            ordreModel.RegTime = DateTime.Now;

            if (!String.IsNullOrEmpty(yeyRequest.Params("keyID")))
            {
                servComm.Update(ordreModel);
            }
            else
            {
                servComm.Add(ordreModel);
            }


            string AccessoryList = Request["OtherList"];
            if (AccessoryList != "")
            {
            }
            string photoList = Request["photoList"];
            if (photoList != "")
            {
            }


            int index = 1;
            IList <WORDERSDETAIL> listOrders = (IList <WORDERSDETAIL>)Session["productList"];

            if (listOrders != null)
            {
            }

            Response.Redirect("OrderList.aspx?type=Order");
        }
    }
    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();
        }
    }
Exemplo n.º 25
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
        //{

        //}
    }
    private void getSceneryList()
    {
        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("OrderNumber", Request["OrderNumber"], SearchComponent.Equals, SearchPad.NULL);
        ccWhere.AddComponent("BelongFactory", LoginUser.BelongFactory, SearchComponent.Equals, SearchPad.And);
        servComm.strOrderString = " ModifyDate desc ";
        DataTable dtTalk = servComm.GetListTop(0, "OrderMessage", ccWhere);



        List <string> talkList     = new List <string>();
        List <string> talkListTemp = new List <string>();
        List <string> pageTalkList = new List <string>();

        if (CacheHelper.GetInfoByIdentify(LoginUser.BelongFactory + "|" + Request["OrderNumber"]) != null)
        {
            talkListTemp = CacheHelper.GetInfoByIdentify(LoginUser.BelongFactory + "|" + Request["OrderNumber"]);
            //talkListTemp.Reverse();
            talkList.AddRange(talkListTemp.AsEnumerable <string>());
            talkList.Reverse();
        }
        for (int i = 0; i < dtTalk.Rows.Count; i++)
        {
            talkListTemp = XmlSerializerHelper.DeserializeObject(dtTalk.Rows[i]["TalkContent"].ToString());
            talkListTemp.Reverse();
            talkList.AddRange(talkListTemp.AsEnumerable <string>());
        }


        pageTalkList = talkList.GetRange((iPageIndex - 1) * iPageCount, (talkList.Count - (iPageIndex - 1) * iPageCount) > 10 ? 10 : talkList.Count - (iPageIndex - 1) * iPageCount);
        pageTalkList.Reverse();

        if (iPageCount <= 1)
        {
            iPageCount = servComm.PageCount;
            iPageIndex = 1;
        }

        int    PageCount = (talkList.Count - 1) / iPageCount + 1;
        string talkJson  = "";

        //string backstr = Json.ListToJson("replyJson", talkList, string.Format("\"PageCount\":\"{0}\",", iPageCount)).Replace("\n", "<br/>").Replace("\r", "<br/>");
        for (int i = 0; i < pageTalkList.Count; i++)
        {
            string talkTime = pageTalkList[i].Split('|')[0];
            string talkUser = pageTalkList[i].Split('|')[1];

            string talkMessage = pageTalkList[i].Replace(talkTime + "|" + talkUser + "|", "").Replace("\"", "\\\"").Replace("\n", "").Replace("\r", "");
            talkJson = talkJson + ",{" + "\"TalkMessage\":" + "\"" + talkMessage + "\"" + ",\"TalkTime\":" + "\"" + talkTime + "\"" + ",\"TalkUser\":" + "\"" + talkUser + "\"" + "}";
        }
        if (talkJson == "")
        {
            Response.Write("{\"PageCount\":0}");
            Response.End();
        }
        else
        {
            talkJson = talkJson.Substring(1);
            talkJson = "{" + "\"PageCount\":" + PageCount + ",\"replyJson\"" + ":[" + talkJson + "]}";
            //if (talkJson.IndexOf("\\") >= 0)
            //{
            //    talkJson = talkJson.Replace("\\", "\\\\");
            //}

            Response.Write(talkJson);
            Response.End();
        }
    }
    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)
        {
        }
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string actiontype = Request["actiontype"];

        if (!IsPostBack)
        {
            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);
        }
        if (actiontype == "GetSaleList")
        {
            string BillNo = Request["BillNo"];
            ccwhere.Clear();
            if (!String.IsNullOrEmpty(BillNo))
            {
                ccwhere.AddComponent("BillNo", "%" + BillNo.Trim() + "%", SearchComponent.Like, SearchPad.And);
            }
            string Salesperson = Request["Salesperson"];
            if (!String.IsNullOrEmpty(Salesperson))
            {
                ccwhere.AddComponent("Salesperson", "%" + Salesperson.Trim() + "%", 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);
            }
            int    iPageCount   = 0;
            string strPageIndex = Request["PageIndex"] == null ? "0" : Request["PageIndex"];
            int    iPageIndex   = int.Parse(strPageIndex) + 1;
            servComm.strOrderString = "Id desc";
            listObj = servComm.GetList <ModelSale>("Sale", "*", "Id", 10, iPageIndex, iPageCount, ccwhere);
            listObj.ToList().ForEach(eo => eo.Seller = (listSeler.Where(le => le.Serial == eo.Seller).Count() > 0 ? listSeler.Where(le => le.Serial == eo.Seller).FirstOrDefault().Client : ""));


            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 == "DisableOrderAction")
        {
            string Ids    = Request["CheckOrder"];
            string result = "0";
            try
            {
                servComm.ExecuteSql("update Sale set IsDel = 1 where Id in (" + Ids + ")");
                result = "1";
            }
            catch (Exception ex)
            {
                result = "0";
            }
            Response.Write(result);
            Response.End();
        }
        else if (actiontype == "ReuseOrderAction")
        {
            string Ids    = Request["CheckOrder"];
            string result = "0";
            try
            {
                servComm.ExecuteSql("update Sale set IsDel = 0 where Id in (" + Ids + ")");
                result = "1";
            }
            catch (Exception ex)
            {
                result = "0";
            }
            Response.Write(result);
            Response.End();
        }
        else if (actiontype == "ExportExcel")
        {
            ccwhere.Clear();
            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";
            string fieldShow = "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Addr],[receiver],[Tel],[distri],[distriNo],[Reg],[RegTime]";
            listObj = servComm.GetListTop <ModelSale>(0, fieldShow, "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 dt         = new DataTable();
                string[]  splitField = fieldShow.Split(',');
                for (int i = 0; i < splitField.Length; i++)
                {
                    dt.Columns.Add(splitField[i].Trim('[').Trim(']'));
                }

                DataTable dtTable = listObj.ToDataTable(dt);
                //dtTable.Columns.Remove("IsDel");
                int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true);
            }
            Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName);
            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();
            }
        }
    }
Exemplo n.º 30
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("Order_ID", Order_ID, SearchComponent.Equals, SearchPad.NULL);
            ccWhere.AddComponent("serial", serial, SearchComponent.Equals, SearchPad.And);
            //GetFilterByKind(ref ccWhere);
            //DataTable dtOrder = facservComm.GetListTop(0, "* ", "VWORDERS", ccWhere);
            DataTable dtOrder = facservComm.ExecuteSqlDatatable(VWORDERS + " where " + ccWhere.sbComponent);

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

            DataTable dtOrderOther   = facservComm.GetListTop(0, "* ", "ordersOther", ccWhere);
            int       count          = dtOrderOther.Rows.Count;
            DataTable dtConstruction = new ReportDataSet.OrderOthersDataTable();
            for (int i = 1; i <= count / 3; i++)
            {
                dtConstruction.Rows.Add(dtConstruction.NewRow());
                dtConstruction.Rows[i - 1]["name1"] = dtOrderOther.Rows[(i - 1) * 3]["name"];
                dtConstruction.Rows[i - 1]["qty1"]  = dtOrderOther.Rows[(i - 1) * 3]["qty"];
                dtConstruction.Rows[i - 1]["name2"] = dtOrderOther.Rows[i * 3 - 1]["name"];
                dtConstruction.Rows[i - 1]["qty2"]  = dtOrderOther.Rows[i * 3 - 1]["qty"];
                dtConstruction.Rows[i - 1]["name3"] = dtOrderOther.Rows[i * 3 - 2]["name"];
                dtConstruction.Rows[i - 1]["qty3"]  = dtOrderOther.Rows[i * 3 - 2]["qty"];
            }

            if (count % 3 == 2)
            {
                dtConstruction.Rows.Add(dtConstruction.NewRow());
                dtConstruction.Rows[count / 3]["name1"] = dtOrderOther.Rows[count - 2]["name"];
                dtConstruction.Rows[count / 3]["qty1"]  = dtOrderOther.Rows[count - 2]["qty"];
                dtConstruction.Rows[count / 3]["name2"] = dtOrderOther.Rows[count - 1]["name"];
                dtConstruction.Rows[count / 3]["qty2"]  = dtOrderOther.Rows[count - 1]["qty"];
                dtConstruction.Rows[count / 3]["name3"] = "";
                dtConstruction.Rows[count / 3]["qty3"]  = "";
            }

            if (count % 3 == 1)
            {
                dtConstruction.Rows.Add(dtConstruction.NewRow());
                dtConstruction.Rows[count / 3]["name1"] = dtOrderOther.Rows[count - 1]["name"];
                dtConstruction.Rows[count / 3]["qty1"]  = dtOrderOther.Rows[count - 1]["qty"];
                dtConstruction.Rows[count / 3]["name2"] = "";
                dtConstruction.Rows[count / 3]["qty2"]  = "";
                dtConstruction.Rows[count / 3]["name3"] = "";
                dtConstruction.Rows[count / 3]["qty3"]  = "";
            }



            //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", dtOrder));
            this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", dtOrderDetail));
            this.FinanceReportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet3", dtConstruction));
        }
    }