Ejemplo n.º 1
0
        /// <summary>
        /// 获取已认证并登记进微信企业号中的人员数。
        /// </summary>
        /// <returns></returns>
        //public int GetIsQYUser_Sum()
        //{
        //    return dbContext.Repairman.Where(o => o.IsQYUser == true).Count();
        //}

        #endregion

        public Tiyi.JD.SQLServerDAL.Repairman NewRepairman(Tiyi.JD.SQLServerDAL.Repairman user)
        {
            if (user != null)
            {
                if (!ExistUser(user.JobNumber))
                {
                    user.WxgId = Guid.NewGuid();
                    dbContext.Repairman.InsertOnSubmit(user);
                    dbContext.SubmitChanges();
                }
            }
            return(user);
        }
Ejemplo n.º 2
0
 public void UpdateRepairman(Tiyi.JD.SQLServerDAL.Repairman userinfo)
 {
     dbContext.SubmitChanges();
 }
Ejemplo n.º 3
0
    protected void formView_ItemCommand(object sender, FormViewCommandEventArgs e)
    {
        Guid wxgId = Guid.Empty;

        Guid.TryParse(hfWxgId.Value, out wxgId);

        if (e.CommandName == "UpdateRepairman")
        {
            Tiyi.JD.SQLServerDAL.Repairman record = bll_RepairmanManage.GetRepairmanById(wxgId);

            // 工号
            TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox;
            record.JobNumber = tbJobNumber.Text;

            // 姓名
            TextBox tbRealName = formView.FindControl("tbRealName") as TextBox;
            record.RealName = tbRealName.Text;

            // 手机号码
            TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox;
            record.MobilePhone = tbMobilePhone.Text;

            bll_RepairmanManage.UpdateRepairman(record);
            if (Updated != null)
            {
                Updated(this, new EventArgs());
            }
        }

        if (e.CommandName == "InsertRepairman")
        {
            Tiyi.JD.SQLServerDAL.Repairman record = new Tiyi.JD.SQLServerDAL.Repairman();

            // 工号
            TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox;
            record.JobNumber = tbJobNumber.Text;

            // 姓名
            TextBox tbRealName = formView.FindControl("tbRealName") as TextBox;
            record.RealName = tbRealName.Text;

            // 手机号码
            TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox;
            record.MobilePhone = tbMobilePhone.Text;

            Tiyi.JD.SQLServerDAL.Repairman user = bll_RepairmanManage.NewRepairman(record);
            if (RepairmanCreated != null)
            {
                hfWxgId.Value = user.WxgId.ToString();
                RepairmanInsertedEventArgs args = new RepairmanInsertedEventArgs(user);
                RepairmanCreated(this, args);
            }
        }

        if (e.CommandName == "DeleteRepairman")
        {
            bll_RepairmanManage.DeleteRepairman(wxgId);
            if (Deleted != null)
            {
                Deleted(this, new EventArgs());
            }
        }

        if (e.CommandName == "CancelUpdate" || e.CommandName == "CancelInsert")
        {
            if (Canceled != null)
            {
                Canceled(this, new EventArgs());
            }
        }
    }
Ejemplo n.º 4
0
    protected void PaigongBillView_ItemCommand(object sender, FormViewCommandEventArgs e)
    {
        Guid bxId = Guid.Empty;

        Guid.TryParse(hfBxId.Value, out bxId);

        if (e.CommandName == "InsertBill")
        {
            Tiyi.JD.SQLServerDAL.BaoxiuBill bxBill = bll_baoxiu.GetBaoxiuBill(bxId);
            if (bxBill == null)
            {
                return;
            }

            Tiyi.JD.SQLServerDAL.PaigongBill pgBill = new Tiyi.JD.SQLServerDAL.PaigongBill();

            pgBill.BxId      = bxBill.BxId;
            pgBill.AppId     = bxBill.AppId;
            pgBill.ProductSN = bxBill.ProductSN;
            pgBill.BigClass  = bxBill.BigClass;
            pgBill.AppType   = bxBill.AppType;
            pgBill.DepName   = bxBill.DepName;


            TextBox tbUserName = formView.FindControl("tbUserName") as TextBox;
            pgBill.UserName = tbUserName.Text;

            TextBox tbUserMobilePhone = formView.FindControl("tbUserMobilePhone") as TextBox;
            pgBill.UserMobilePhone = tbUserMobilePhone.Text;

            TextBox tbUserMobileShort = formView.FindControl("tbUserMobileShort") as TextBox;
            pgBill.UserMobileShort = tbUserMobileShort.Text;

            TextBox tbAddress = formView.FindControl("tbAddress") as TextBox;
            pgBill.Address = tbAddress.Text;

            TextBox tbFaultPhenomenon = formView.FindControl("tbFaultPhenomenon") as TextBox;
            pgBill.FaultPhenomenon = tbFaultPhenomenon.Text;

            TextBox tbRemark = formView.FindControl("tbRemark") as TextBox;
            pgBill.Remark = tbRemark.Text;

            DropDownList ddlWxg = formView.FindControl("ddlWxg") as DropDownList;
            Guid         wxgId  = Guid.Empty;
            Guid.TryParse(ddlWxg.SelectedValue, out wxgId);
            Tiyi.JD.SQLServerDAL.Repairman wxg = bll_wxg.GetRepairmanById(wxgId);
            if (wxg != null)
            {
                pgBill.WxgId          = wxgId;
                pgBill.WxgRealName    = wxg.RealName;
                pgBill.WxgMobilePhone = wxg.MobilePhone;
                pgBill.WxgMobileShort = wxg.MobileShort;
            }


            Tiyi.JD.SQLServerDAL.PaigongBill newBill = bll_Paigong.CreatePaigongBill(pgBill);
            if (newBill != null && BillCreated != null)
            {
                hfPgId.Value = newBill.PgId.ToString();
                BillInsertedEventArgs args = new BillInsertedEventArgs(newBill);
                BillCreated(this, args);
            }
        }

        if (e.CommandName == "UpdateBill")
        {
            Guid pgId = Guid.Empty;
            Guid.TryParse(hfPgId.Value, out pgId);
            Tiyi.JD.SQLServerDAL.PaigongBill pgBill = bll_Paigong.GetPaigongBill(pgId);

            TextBox tbUserName = formView.FindControl("tbUserName") as TextBox;
            pgBill.UserName = tbUserName.Text;

            TextBox tbUserMobilePhone = formView.FindControl("tbUserMobilePhone") as TextBox;
            pgBill.UserMobilePhone = tbUserMobilePhone.Text;

            TextBox tbUserMobileShort = formView.FindControl("tbUserMobileShort") as TextBox;
            pgBill.UserMobileShort = tbUserMobileShort.Text;

            TextBox tbAddress = formView.FindControl("tbAddress") as TextBox;
            pgBill.Address = tbAddress.Text;

            TextBox tbFaultPhenomenon = formView.FindControl("tbFaultPhenomenon") as TextBox;
            pgBill.FaultPhenomenon = tbFaultPhenomenon.Text;

            TextBox tbRemark = formView.FindControl("tbRemark") as TextBox;
            pgBill.Remark = tbRemark.Text;

            DropDownList ddlWxg = formView.FindControl("ddlWxg") as DropDownList;
            Guid         wxgId  = Guid.Empty;
            Guid.TryParse(ddlWxg.SelectedValue, out wxgId);
            Tiyi.JD.SQLServerDAL.Repairman wxg = bll_wxg.GetRepairmanById(wxgId);
            if (wxg != null)
            {
                pgBill.WxgId          = wxgId;
                pgBill.WxgRealName    = wxg.RealName;
                pgBill.WxgMobilePhone = wxg.MobilePhone;
                pgBill.WxgMobileShort = wxg.MobileShort;
            }

            bll_Paigong.UpdatePaigongBill(pgBill);
            if (Updated != null)
            {
                Updated(this, new EventArgs());
            }
        }

        if (e.CommandName == "InsertCancel" || e.CommandName == "UpdateCancel")
        {
            if (Updated != null)
            {
                Updated(this, new EventArgs());
            }
        }

        if (e.CommandName == "EditBill")
        {
            formView.ChangeMode(FormViewMode.Edit);
        }

        if (e.CommandName == "WxRemind")
        {
            Guid pgId = Guid.Empty;
            Guid.TryParse(hfPgId.Value, out pgId);
            Tiyi.JD.SQLServerDAL.PaigongBill pgBill = bll_Paigong.GetPaigongBill(pgId);

            Tiyi.Weixin.Work.Article article = new Tiyi.Weixin.Work.Article();
            article.Title = "收到维修派工单";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendLine("设备类型:" + pgBill.BigClass + pgBill.AppType);
            sb.AppendLine("详细地址:" + pgBill.Address);
            sb.AppendLine("联系方式:" + pgBill.UserName + " " + pgBill.UserMobilePhone + " (短号:" + pgBill.UserMobileShort + ")");
            sb.AppendLine("派工时间:" + DateTime.Now.ToString() + "\n");
            sb.AppendLine("故障现象:" + pgBill.FaultPhenomenon);
            sb.AppendLine("备注信息:" + pgBill.Remark);
            article.Description = sb.ToString();
            article.Url         = "";
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string articleJson = js.Serialize(article);
            ws_wxSender.SendArticleToUser("101527", articleJson, "34");

            Literal ltlSendWxResult = formView.FindControl("ltlSendWxResult") as Literal;
            ltlSendWxResult.Text = "微信提醒发送成功";
        }
    }
Ejemplo n.º 5
0
 public RepairmanInsertedEventArgs(Tiyi.JD.SQLServerDAL.Repairman user)
 {
     this._user = user;
 }