Example #1
0
        /// <summary>
        /// 校验税收类型是否重复
        /// </summary>
        void CheckRegionCate(HttpContext context)
        {
            bool result = false;
            long id     = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]))
            {
                long.TryParse(context.Request.QueryString["id"], out id);
            }
            long regionId = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["regionId"]))
            {
                long.TryParse(context.Request.QueryString["regionId"], out regionId);
            }
            long cateId = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["cateId"]))
            {
                long.TryParse(context.Request.QueryString["cateId"], out cateId);
            }
            if (cateId != 0 && regionId != 0)
            {
                result = new GeneralBLL().CheckRegionCate(regionId, cateId, id);
            }
            WriteResponseJson(result);
        }
Example #2
0
        /// <summary>
        /// 获取字典项
        /// </summary>
        /// <param name="context"></param>
        private void GetDics(HttpContext context)
        {
            long tableId = long.Parse(context.Request.QueryString["id"]);
            var  list    = new GeneralBLL().GetDicValues(tableId);

            context.Response.Write(new Tools.Serialize().SerializeJson(list));
        }
        protected void Save_Close_Click(object sender, EventArgs e)
        {
            var field = new GeneralBLL().GetSingleGeneral(id);

            field.name = this.Name.Text.Trim().ToString();
            if (this.Active.Checked)
            {
                field.ext1 = "1";
            }
            else
            {
                field.ext1 = "0";
            }
            var result = new GeneralBLL().Update(field, GetLoginUserId());

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                Response.Write("<script>alert('销售指标度量修改成功!');self.opener.location.reload();window.close();</script>");
            }
            else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
            {
                Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                Response.Redirect("../Login.aspx");
            }
            else if (result == DTO.ERROR_CODE.EXIST)
            {
                Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
            }
        }
Example #4
0
 /// <summary>
 /// 处理需要保存的数据
 /// </summary>
 public bool save_deal()
 {
     if (id > 0)
     {
         region = new GeneralBLL().GetSingleGeneral(id);
     }
     region.name = this.Region_Name.Text.Trim().ToString();
     if (!string.IsNullOrEmpty(this.Region_Description.Text.Trim().ToString()))
     {
         region.remark = this.Region_Description.Text.Trim().ToString();
     }
     if (id > 0)
     {
         var result = new GeneralBLL().Update(region, GetLoginUserId());
         if (result == ERROR_CODE.SUCCESS)
         {
             Response.Write("<script>alert('区域修改成功');</script>");
             return(true);
         }
         else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("../Login.aspx");
         }
         else if (result == DTO.ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
         }
         else
         {
             Response.Write("<script>alert('修改区域失败!');</script>");
             return(false);
         }
     }
     else
     {
         region.general_table_id = (int)GeneralTableEnum.REGION;
         var result = new GeneralBLL().Insert(region, GetLoginUserId());
         if (result == ERROR_CODE.SUCCESS)
         {
             Response.Write("<script>alert('新增区域成功');</script>");
             return(true);
         }
         else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("../Login.aspx");
         }
         else if (result == DTO.ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称,请修改');</script>");
         }
         else
         {
             Response.Write("<script>alert('新增区域失败!');</script>");
             return(false);
         }
     }
     return(false);
 }
Example #5
0
        void ActiveGeneral(HttpContext context)
        {
            bool result   = false;
            bool isAvtive = false;

            if (!string.IsNullOrEmpty(context.Request.QueryString["isActive"]) && context.Request.QueryString["isActive"] == "1")
            {
                isAvtive = true;
            }
            long id = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]) && long.TryParse(context.Request.QueryString["id"], out id))
            {
                var resType = DTO.ERROR_CODE.ERROR;
                if (isAvtive)
                {
                    resType = new GeneralBLL().Active(id, LoginUserId);
                }
                else
                {
                    resType = new GeneralBLL().NoActive(id, LoginUserId);
                }
                if (resType == DTO.ERROR_CODE.SUCCESS)
                {
                    result = true;
                }
            }
            WriteResponseJson(result);
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var type  = new SysSettingBLL().GetValueById(SysSettingEnum.CRM_OPPORTUNITY_LOSS_REASON);
            int value = 0;

            if (!int.TryParse(type, out value))
            {
                needReasonType = DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_NONE;
            }
            else
            {
                needReasonType = (DicEnum.SYS_CLOSE_OPPORTUNITY)value;
            }

            if (needReasonType != DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_NONE)
            {
                var list = new GeneralBLL().GetDicValues(GeneralTableEnum.OPPORTUNITY_LOSS_REASON_TYPE);
                LossReasonList.DataTextField  = "show";
                LossReasonList.DataValueField = "val";
                LossReasonList.DataSource     = list;
                LossReasonList.DataBind();
                LossReasonList.Items.Insert(0, new ListItem()
                {
                    Value = "", Text = "   ", Selected = true
                });
            }

            if (IsPostBack)
            {
                if (needReasonType == DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_TYPE_DETAIL)
                {
                    lossReason = DNRequest.GetQueryStringValue("LossReasonDetail", "");
                }
            }
        }
Example #7
0
        /// <summary>
        /// 修改知识库的类别( 某一类别下的所有知识库包括子类别的所有知识库 )
        /// </summary>
        public void ChangeArtCate(long cateId, long userId, int parentId)
        {
            var subArt  = _dal.GetArtByCate(cateId);
            var dgDal   = new d_general_dal();
            var gBll    = new GeneralBLL();
            var subMenu = dgDal.GetGeneralByParentId(cateId);

            if (subArt != null && subArt.Count > 0)
            {
                foreach (var art in subArt)
                {
                    subArt.ForEach(_ => {
                        _.kb_category_id = parentId;
                        UpdateKnow(_, userId);
                    });
                }
            }
            if (subMenu != null && subMenu.Count > 0)
            {
                foreach (var menu in subMenu)
                {
                    ChangeArtCate(menu.id, userId, parentId);
                    dgDal.SoftDelete(menu, userId);
                    OperLogBLL.OperLogAdd <d_general>(menu, menu.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录");
                }
            }
        }
Example #8
0
        /// <summary>
        /// 删除知识库目录
        /// </summary>
        public bool DeleteKnowMenu(long cateId, long userId, ref string failReason)
        {
            var dgDal = new d_general_dal();
            var cate  = dgDal.FindNoDeleteById(cateId);

            if (cate == null)
            {
                return(true);
            }
            if (cate.parent_id == null)
            {
                failReason = "根目录不可删除";
                return(false);
            }
            var gBll = new GeneralBLL();

            ChangeArtCate(cateId, userId, (int)cate.parent_id);
            //var subMenu = dgDal.GetGeneralByParentId(cateId);
            //if (subMenu != null && subMenu.Count > 0)
            //    subMenu.ForEach(_ => {
            //        _.parent_id = cate.parent_id;
            //        gBll.EditGeneral(_,userId);
            //    });
            //var subArt = _dal.GetArtByCate(cateId);
            //if(subArt!=null&& subArt.Count > 0)
            //    subArt.ForEach(_=> {
            //        _.kb_category_id = (int)cate.parent_id;
            //        UpdateKnow(_,userId);
            //    });
            dgDal.SoftDelete(cate, userId);
            OperLogBLL.OperLogAdd <d_general>(cate, cate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "删除知识库目录");
            return(true);
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new GeneralBLL();

            if (long.TryParse(Request.QueryString["id"], out id))
            {
                isAdd = false;
                var holiday = bll.GetSingleGeneral(id);
                name        = holiday.name;
                description = holiday.remark;
            }
            if (IsPostBack)
            {
                string hname = Request.Form["holidayName"];
                string hdesc = Request.Form["description"];
                if (isAdd)
                {
                    bll.AddHolidaySet(hname, hdesc, LoginUserId);
                }
                else
                {
                    if (hdesc != description || hname != name)
                    {
                        bll.EditHolidaySet(id, hname, hdesc, LoginUserId);
                    }
                }
                Response.Write("<script>window.close();self.opener.location.reload();</script>");
                Response.End();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt64(Request.QueryString["id"]);
     if (!IsPostBack)
     {
         if (id > 0)
         {
             var field = new GeneralBLL().GetSingleGeneral(id);
             if (field == null)
             {
                 Response.Write("<script>alert('获取相关信息失败,返回上一个页面');window.close();</script>");
             }
             else
             {
                 this.Name.Text = field.name.ToString();
                 if (field.ext1 != null && Convert.ToInt32(field.ext1.ToString()) > 0)
                 {
                     this.Active.Checked = true;
                 }
             }
         }
         else
         {
             Response.Write("<script>alert('获取相关信息失败,返回上一个页面');window.close();</script>");
         }
     }
 }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new GeneralBLL();

            if (long.TryParse(Request.QueryString["id"], out id))
            {
                isAdd = false;
                var holiday = bll.GetHoliday(id);
                name = holiday.description;
                date = holiday.hd;
                type = holiday.hd_type;
            }
            if (!long.TryParse(Request.QueryString["hid"], out holidaySetId) && isAdd)    // 新增需要带入节假日id
            {
                Response.End();
                return;
            }
            if (IsPostBack)
            {
                name = Request.Form["holidayName"];
                string hdate = Request.Form["hd"];
                date = DateTime.Parse(hdate);
                type = int.Parse(Request.Form["type"]);
                if (isAdd)
                {
                    d_holiday hld = new d_holiday
                    {
                        description    = name,
                        hd             = date.Value,
                        hd_type        = type,
                        holiday_set_id = (int)holidaySetId,
                    };
                    if (bll.AddHoliday(hld, LoginUserId))
                    {
                        Response.Write("<script>window.close();self.opener.location.reload();</script>");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("<script>alert('新增失败,日期重复!');</script>");
                    }
                }
                else
                {
                    if (bll.EditHoliday(id, name, date.Value, type, LoginUserId))
                    {
                        Response.Write("<script>window.close();self.opener.location.reload();</script>");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("<script>alert('新增失败,日期重复!');</script>");
                    }
                }
            }
        }
Example #12
0
        /// <summary>
        /// 删除技能/证书/学位 相关字典表
        /// </summary>
        void DeleteSkillFromGeneral(HttpContext context)
        {
            bool result = false;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]))
            {
                result = new GeneralBLL().DeleteResourceGeneral(long.Parse(context.Request.QueryString["id"]), LoginUserId);
            }
            WriteResponseJson(result);
        }
Example #13
0
        /// <summary>
        /// 税种删除校验
        /// </summary>
        void TaxCateDeleteCheck(HttpContext context)
        {
            bool result = false;
            long id     = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]) && long.TryParse(context.Request.QueryString["id"], out id))
            {
                result = new GeneralBLL().CheckTaxCateDelete(id);
            }
            WriteResponseJson(result);
        }
Example #14
0
        /// <summary>
        /// 删除工单子问题校验
        /// </summary>
        void DeleteTicketSubIssue(HttpContext context)
        {
            bool   result = false;
            string reason = string.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["ids"]))
            {
                result = new GeneralBLL().DeleteGeneralSubIssue(context.Request.QueryString["ids"], LoginUserId, ref reason);
            }
            WriteResponseJson(new { result = result, reason = reason });
        }
Example #15
0
        /// <summary>
        /// 删除分税
        /// </summary>
        void DeleteRegionTax(HttpContext context)
        {
            bool result = false;
            long id     = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]) && long.TryParse(context.Request.QueryString["id"], out id))
            {
                result = new GeneralBLL().DeleteRegionTax(id, LoginUserId);
            }
            WriteResponseJson(result);
        }
Example #16
0
        /// <summary>
        /// 校验名称重复
        /// </summary>
        void CheckExist(HttpContext context)
        {
            bool result = false;
            long id     = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]))
            {
                long.TryParse(context.Request.QueryString["id"], out id);
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["tableId"]) && !string.IsNullOrEmpty(context.Request.QueryString["name"]))
            {
                result = new GeneralBLL().CheckExist(context.Request.QueryString["name"], int.Parse(context.Request.QueryString["tableId"]), id);
            }
            WriteResponseJson(result);
        }
Example #17
0
        private void btnRptView_Click(object sender, EventArgs e)
        {
            try
            {
                frmReportViewer objRpt            = new frmReportViewer();
                ReportDocument  objRptDoc         = new ReportDocument();
                ConnectionInfo  objConInfo        = new ConnectionInfo();
                TableLogOnInfo  objTableLogOnInfo = new TableLogOnInfo();
                Tables          objCrTables;

                objRptDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Reports\\rptEmpWiseVistDet.rpt");
                objConInfo.ServerName         = GeneralBLL.GetSqlServerPCName();
                objConInfo.DatabaseName       = GeneralBLL.GetDatabaseName();
                objConInfo.UserID             = GeneralBLL.GetDBUserName();
                objConInfo.Password           = GeneralBLL.GetDBPwd();
                objConInfo.IntegratedSecurity = false;

                objCrTables = objRptDoc.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table objCrTable in objCrTables)
                {
                    objTableLogOnInfo = objCrTable.LogOnInfo;
                    objTableLogOnInfo.ConnectionInfo = objConInfo;
                    objCrTable.ApplyLogOnInfo(objTableLogOnInfo);
                }

                DateTime mFromDate = Convert.ToDateTime(dtpFromDate.Text);
                DateTime mToDate   = Convert.ToDateTime(dtpToDate.Text);

                if (cboEmployee.Text != "ALL")
                {
                    objRptDoc.RecordSelectionFormula = " Date({VISITORGATEPASS.GATEDATE})>= #" + dtpFromDate.Text + "# And Date({VISITORGATEPASS.GATEDATE})<= #" + dtpToDate.Text + "# And ({VISITORGATEPASS.TOMEET}) = '" + cboEmployee.Text + "'";
                }
                else
                {
                    objRptDoc.RecordSelectionFormula = " Date({VISITORGATEPASS.GATEDATE})>= #" + dtpFromDate.Text + "# And Date({VISITORGATEPASS.GATEDATE})<= #" + dtpToDate.Text + "# ";
                }
                objRpt.crystalReportViewer1.ReportSource = objRptDoc;
                objRpt.MdiParent   = this.MdiParent;
                objRpt.WindowState = FormWindowState.Maximized;
                objRpt.crystalReportViewer1.Refresh();
                objRpt.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                AppLogger.Error(ex.Message.ToString() + "\n" + ex.InnerException.Message.ToString());
            }
        }
Example #18
0
        public void Active(HttpContext context, long general_i)
        {
            var result = new GeneralBLL().Active(general_i, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("激活成功!");
            }
            else if (result == DTO.ERROR_CODE.ACTIVATION)
            {
                context.Response.Write("已经激活,无需此操作!");
            }
            else
            {
                context.Response.Write("激活失败!");
            }
        }
Example #19
0
        public void No_Active(HttpContext context, long type_id)
        {
            var result = new GeneralBLL().NoActive(type_id, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("停用成功!");
            }
            else if (result == DTO.ERROR_CODE.NO_ACTIVATION)
            {
                context.Response.Write("已是停用状态,无需此操作!");
            }
            else
            {
                context.Response.Write("停用失败!");
            }
        }
Example #20
0
        /// <summary>
        /// 数据保存处理
        /// </summary>
        private bool save_deal()
        {
            bool      status = false;
            d_general terr   = new d_general();

            if (id > 0)
            {
                terr   = new GeneralBLL().GetSingleGeneral(id);
                status = true;
            }
            terr.name = this.Territory_Name.Text.Trim().ToString();
            if (Convert.ToInt32(this.Region.SelectedValue.ToString()) > 0)
            {
                terr.parent_id = Convert.ToInt32(this.Region.SelectedValue.ToString());
            }
            if (!string.IsNullOrEmpty(this.Territory_Description.Text.Trim().ToString()))
            {
                terr.remark = this.Territory_Description.Text.Trim().ToString();
            }
            var result = stbll.SaveTerritory(terr, GetLoginUserId(), ref id);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                if (status)
                {
                    Response.Write("<script>alert('客户地域修改成功!');</script>");
                }
                else
                {
                    Response.Write("<script>alert('客户地域添加成功!');</script>");
                }
                return(true);
            }
            else
            if (result == DTO.ERROR_CODE.EXIST)
            {
                Response.Write("<script>alert('已经存在该名称地域');</script>");
            }
            else
            if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
            {
                Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                Response.Redirect("../Login.aspx");
            }
            return(false);
        }
Example #21
0
        /// <summary>
        /// 获取技能、证书、学位类别
        /// </summary>
        /// <param name="context"></param>
        private void GetSkillCates(HttpContext context)
        {
            List <DictionaryEntryDto> list = null;

            if (context.Request.QueryString["type"] == "1")
            {
                list = new GeneralBLL().GetDicValues(GeneralTableEnum.SKILLS_CATE, (long)DicEnum.SKILLS_CATE_TYPE.SKILLS);
            }
            if (context.Request.QueryString["type"] == "2")
            {
                list = new GeneralBLL().GetDicValues(GeneralTableEnum.SKILLS_CATE, (long)DicEnum.SKILLS_CATE_TYPE.CERTIFICATION);
            }
            if (context.Request.QueryString["type"] == "3")
            {
                list = new GeneralBLL().GetDicValues(GeneralTableEnum.SKILLS_CATE, (long)DicEnum.SKILLS_CATE_TYPE.DEGREE);
            }
            context.Response.Write(new Tools.Serialize().SerializeJson(list));
        }
Example #22
0
        public void NoActive(HttpContext context, long reason_id)
        {
            //此处写复制逻辑

            var result = new GeneralBLL().NoActive(reason_id, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("停用成功!");
            }
            else if (result == DTO.ERROR_CODE.NO_ACTIVATION)
            {
                context.Response.Write("已经停用,无需此操作!");
            }
            else
            {
                context.Response.Write("停用失败!");
            }
        }
Example #23
0
        public void Delete(HttpContext context, long general_id, long general_table_id)
        {
            //此处写复制逻辑

            var result = new GeneralBLL().Delete(general_id, LoginUserId, general_table_id);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("success");
            }
            else if (result == DTO.ERROR_CODE.SYSTEM)
            {
                context.Response.Write("system");
            }
            else
            {
                context.Response.Write("error");
            }
        }
Example #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);//获取id
     // id = 2;
     if (!IsPostBack)
     {
         //Region下拉框
         var dic = stbll.GetRegionDownList();
         this.Region.DataTextField  = "show";
         this.Region.DataValueField = "val";
         this.Region.DataSource     = dic.FirstOrDefault(_ => _.Key == "Region").Value;
         this.Region.DataBind();
         Region.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "   ", Selected = true
         });
         //操作
         if (id > 0)//修改
         {
             var a = new GeneralBLL().GetSingleGeneral(id);
             if (a == null)
             {
                 Response.Write("<script>alert('获取地域相关信息失败,无法修改!');window.close();self.opener.location.reload();</script>");
             }
             else
             {
                 this.Territory_Name.Text = a.name.ToString();
                 if (a.parent_id != null)
                 {
                     this.Region.SelectedValue = a.parent_id.ToString();
                 }
                 if (a.remark != null && !string.IsNullOrEmpty(a.remark.ToString()))
                 {
                     this.Territory_Description.Text = a.remark.ToString();
                 }
             }
             //获取地域所属员工
             AccountList = stbll.GetAccountList(id);
         }
     }
 }
Example #25
0
        public bool DeleteProductCate(long cateId, long userId)
        {
            d_general_dal dgDal   = new d_general_dal();
            var           proList = _dal.FindListBySql <ivt_product>($"SELECT * from ivt_product where delete_time = 0 and cate_id =" + cateId.ToString());

            if (proList != null && proList.Count > 0)
            {
                proList.ForEach(_ => {
                    _.cate_id = null;
                    EditProduct(_, userId);
                });
            }
            var childCateList = dgDal.GetGeneralByParentId(cateId);

            if (childCateList != null && childCateList.Count > 0)
            {
                GeneralBLL genBll = new GeneralBLL();
                childCateList.ForEach(_ => {
                    genBll.Delete(_.id, userId, (long)GeneralTableEnum.PRODUCT_CATE);
                });
            }
            return(true);
        }
Example #26
0
        public void Delete(HttpContext context, long reason_id, long table_id)
        {
            //此处写复制逻辑

            int n;//记录受影响的个数
            var result = new GeneralBLL().Delete_Validate(reason_id, LoginUserId, table_id, out n);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                var kk = new GeneralBLL().Delete(reason_id, LoginUserId, table_id);
                if (kk == DTO.ERROR_CODE.SUCCESS)
                {
                    context.Response.Write("删除成功!");
                }
                else
                {
                    context.Response.Write("删除失败!");
                }
            }
            else if (result == DTO.ERROR_CODE.SYSTEM)
            {
                context.Response.Write("系统默认不能删除!");
            }
            else if (result == DTO.ERROR_CODE.LOSS_OPPORTUNITY_REASON_USED)
            {
                context.Response.Write("有" + n + "个商机关联此丢失商机原因。不能删除!");
            }
            else if (result == DTO.ERROR_CODE.WIN_OPPORTUNITY_REASON_USED)
            {
                context.Response.Write("有" + n + "个商机关联此关闭商机原因。不能删除!");
            }
            else
            {
                context.Response.Write("删除失败!");
            }
        }
Example #27
0
        public override void AjaxProcess(HttpContext context)
        {
            var action           = context.Request.QueryString["act"];
            var general_id       = context.Request.QueryString["id"];
            var general_table_id = context.Request.QueryString["GT_id"];

            if (string.IsNullOrEmpty(general_table_id))
            {
                var general = new GeneralBLL().GetSingleGeneral(Convert.ToInt64(general_id));
                general_table_id = general.general_table_id.ToString();
            }
            switch (action)
            {
            case "delete": Delete(context, Convert.ToInt64(general_id), Convert.ToInt64(general_table_id));; break;

            case "delete_validate": Delete_Validate(context, Convert.ToInt64(general_id), Convert.ToInt64(general_table_id));; break;

            case "active": Active(context, Convert.ToInt64(general_id)); break;

            case "noactive": NoActive(context, Convert.ToInt64(general_id)); break;

            default: break;
            }
        }
Example #28
0
        /// <summary>
        /// 新增合同时添加服务包
        /// </summary>
        /// <param name="context"></param>
        /// <param name="id"></param>
        public void AddServiceBundle(HttpContext context, long id)
        {
            var           serBun          = new ivt_service_bundle_dal().FindById(id);
            string        txt             = "";
            decimal       pricePerPeriod  = 0;
            int           monthsPerPeriod = 1;
            List <object> result          = new List <object>();

            if (serBun == null)
            {
                result.Add(txt);
                result.Add(pricePerPeriod);

                context.Response.Write(new Tools.Serialize().SerializeJson(result));
                return;
            }

            // 获取供应商名称
            string vendorName = "";

            if (serBun.vendor_account_id != null)
            {
                var vendorDal  = new ivt_product_vendor_dal();
                var accountDal = new crm_account_dal();
                var vendor     = vendorDal.FindById((long)serBun.vendor_account_id);
                if (vendor.vendor_account_id != null)
                {
                    vendorName = accountDal.FindById((long)vendor.vendor_account_id).name;
                }
            }

            // 周期
            string period = "";

            if (serBun.period_type_id != null)
            {
                period = new GeneralBLL().GetGeneralName((int)serBun.period_type_id);
                if (serBun.unit_price == null)
                {
                    pricePerPeriod = 0;
                }
                else
                {
                    pricePerPeriod = (decimal)serBun.unit_price;
                }

                if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.QUARTER)
                {
                    monthsPerPeriod = 3;
                }
                if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.HALFYEAR)
                {
                    monthsPerPeriod = 6;
                }
                if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.YEAR)
                {
                    monthsPerPeriod = 12;
                }
            }

            string unitCost = "";

            if (serBun.unit_cost != null)
            {
                unitCost = "¥" + serBun.unit_cost.ToString();
            }

            txt += $"<tr id='service{serBun.id}'>";
            txt += $"<td style='white - space:nowrap; '><img src = '../Images/delete.png' onclick='RemoveServiceBundle({serBun.id})' alt = '' /></ td > ";
            txt += $"<td><span>{serBun.name}</span></td>";
            txt += $"<td nowrap>{vendorName}</td>";
            txt += $"<td nowrap><span>{period}</span><input type='hidden' id='period{serBun.id}' value='{monthsPerPeriod}' ></td>";
            txt += $"<td nowrap align='right'><span>{unitCost}</span></td>";
            txt += $"<td nowrap align='right'>" + $"<input type='text' onblur='CalcService()' id='price{serBun.id}' name='price{serBun.id}' value = '{pricePerPeriod}' >" + "</ td > ";
            txt += $"<td nowrap align='right'>" + $"<input type='text' onblur='CalcService()' id='num{serBun.id}' name='num{serBun.id}' value = '1' >" + "</ td > ";
            txt += $"<td nowrap align='right'>¥" + $"<input type='text' id='pricenum{serBun.id}' value = '{pricePerPeriod}' disabled >" + "</ td > ";
            txt += "</tr>";

            result.Add(txt);
            result.Add(pricePerPeriod);
            result.Add(serBun.id);
            result.Add(monthsPerPeriod);

            context.Response.Write(new Tools.Serialize().SerializeJson(result));
        }
Example #29
0
        protected void Save_Close_Click(object sender, EventArgs e)
        {
            if (id > 0)
            {
                contract_milestone = new GeneralBLL().GetSingleGeneral(id);
                if (contract_milestone == null)
                {
                    Response.Write("<script>alert('获取相关信息失败,无法修改!');</script>");
                }
            }
            contract_milestone.name = this.Name.Text.Trim().ToString();
            if (!string.IsNullOrEmpty(this.SortOrder.Text.Trim().ToString()))
            {
                contract_milestone.sort_order = Convert.ToDecimal(this.SortOrder.Text.Trim().ToString());
            }
            if (this.Active.Checked)
            {
                contract_milestone.is_active = 1;
            }
            if (id > 0)
            {
                //修改

                if ((contract_milestone.sort_order != null && new GeneralBLL().update_sort_order(contract_milestone.id, contract_milestone.general_table_id, (Decimal)contract_milestone.sort_order)) || contract_milestone.sort_order == null)
                {
                    var result = new GeneralBLL().Update(contract_milestone, GetLoginUserId());
                    if (result == ERROR_CODE.SUCCESS)
                    {
                        Response.Write("<script>alert('里程碑状态修改成功!');window.close();self.opener.location.reload();</script>");
                    }
                    else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                    {
                        Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                        Response.Redirect("../Login.aspx");
                    }
                    else if (result == DTO.ERROR_CODE.EXIST)
                    {
                        Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('已经存在相同的排序号,请修改!');</script>");
                }
            }
            else
            {
                //新增
                contract_milestone.general_table_id = (int)GeneralTableEnum.CONTRACT_MILESTONE;
                if ((contract_milestone.sort_order != null && new GeneralBLL().sort_order(contract_milestone.general_table_id, (Decimal)contract_milestone.sort_order)) || contract_milestone.sort_order == null)
                {
                    var result = new GeneralBLL().Insert(contract_milestone, GetLoginUserId());
                    if (result == ERROR_CODE.SUCCESS)
                    {
                        Response.Write("<script>alert('里程碑状态添加成功!');window.close();self.opener.location.reload();</script>");
                    }
                    else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                    {
                        Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                        Response.Redirect("../Login.aspx");
                    }
                    else if (result == DTO.ERROR_CODE.EXIST)
                    {
                        Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('已经存在相同的排序号,请修改!');</script>");
                }
            }
        }
        private void GenerateReport()
        {
            try
            {
                bool isMissed = optMissedCalls.Checked;



                if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753)
                {
                    dtpFromDate.Value = null;
                }

                if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753)
                {
                    dtpTillDate.Value = null;
                }

                DateTime?fromDate = dtpFromDate.Value.ToDateorNull();
                DateTime?tillDate = dtpTillDate.Value.ToDateorNull();

                string phone = txtPhone.Text.Trim();
                string name  = txtName.Text.Trim().ToLower();
                string Line  = txtLine.Text.ToStr();
                string Stn   = txtStn.Text.ToStr();


                var list = (from a in GeneralBLL.GetQueryable <CallHistory>(null)
                            where (fromDate == null || a.CallDateTime.Value.Date >= fromDate) &&
                            (tillDate == null || a.CallDateTime.Value.Date <= tillDate) &&
                            (name == string.Empty || a.Name.Trim().ToLower().StartsWith(name)) &&
                            (phone == string.Empty || a.PhoneNumber.Trim() == phone) &&
                            (Line == string.Empty || a.Line == Line) &&
                            (Stn == string.Empty || a.STN == Stn) &&
                            (isMissed == false || (a.IsAccepted != null && a.IsAccepted == true))
                            orderby a.CallDateTime descending
                            select new
                {
                    Name = a.Name,
                    PhoneNumber = a.PhoneNumber,
                    CallDateTime = a.CallDateTime,
                    Line = a.Line,
                    STN = a.STN
                }).ToList();



                CallHistoryBindingSource.DataSource = list;



                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[6];

                string address = AppVars.objSubCompany.Address;
                string telNo   = "Tel No. " + AppVars.objSubCompany.TelephoneNo;

                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr());
                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);
                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);

                string heading = string.Empty;
                if (fromDate != null && tillDate != null)
                {
                    heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
                }
                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading);
                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_TotalCalls", list.Count.ToStr());


                CallerIdType_Configuration obj = General.GetObject <CallerIdType_Configuration>(c => c.Id != null);
                string DigitalCLIType          = obj.DigitalCLIType.ToStr();

                param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_DigitalCLIType", DigitalCLIType == "" ? "0" : DigitalCLIType);

                reportViewer1.LocalReport.SetParameters(param);

                this.reportViewer1.ZoomPercent = 100;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }