protected void HandleClickLogin(object sender, EventArgs e)
        {
            string email    = tbEmail.Text.Trim();
            string password = tbPassword.Text.Trim();

            UsersDTO result = AuthBLL.Login(email, password);

            if (result != null)
            {
                Session["id"]    = result.ID;
                Session["name"]  = result.Name;
                Session["email"] = result.Email;
                Session["role"]  = result.Role;

                if (result.Role.Equals(Role.Admin))
                {
                    Response.Redirect("/dashboard");
                }
                else
                {
                    Response.Redirect("/");
                }
            }
            else
            {
                lbError.Visible = true;
            }
        }
Beispiel #2
0
 protected bool isTemp = false;      // 判断项目是否时项目模板
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var id = Request.QueryString["id"];
         thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
         if (thisProject != null)
         {
             if (AuthBLL.GetUserProjectAuth(LoginUserId, LoginUser.security_Level_id, thisProject.id).CanView == false)
             {
                 Response.Write("<script>alert('无权查看');window.close();</script>");
                 Response.End();
                 return;
             }
             taskList = new sdk_task_dal().GetProjectTask(thisProject.id);
             if (thisProject.type_id == (int)DicEnum.PROJECT_TYPE.TEMP)
             {
                 isTemp = true;
             }
         }
         else
         {
             Response.End();
         }
     }
     catch (Exception msg)
     {
         Response.End();
     }
 }
Beispiel #3
0
        public JsonResult login(string email, string pwd)
        {
            var response = Request["g-recaptcha-response"];

            if (!validateCaptcha.validateC(response))
            {
                return(Json(responseBLL.create(false, "Captca Hatası", null), JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(pwd))
            {
                ViewBag.Mesaj = "Lütfen gerekli alanları doldurunuz.";
                return(Json(responseBLL.create(false, "Lütfen gerekli alanları doldurunuz.", null), JsonRequestBehavior.AllowGet));
            }
            else
            {
                string Sifre   = hashwithsha.ComputeHash(pwd, "SHA512", Encoding.ASCII.GetBytes(pwd));
                var    control = _user.GetFirstOrDefault(g => g.Password == Sifre && g.Email == email && g.Flag == status.active);
                if (control == null)
                {
                    ViewBag.Mesaj = "Kullanıcı bilgilerine ulaşılamadı.";
                    return(Json(responseBLL.create(false, "Kullanıcı bilgilerine ulaşılamadı.", null), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    AuthBLL.LoadUser(control);
                    return(Json(responseBLL.create(true, "Giriş yapıldı.", null), JsonRequestBehavior.AllowGet));
                }
            }
        }
Beispiel #4
0
        public ApiResultDto GetToken([FromBody] UserAuthDto param)
        {
            TokenDto token;
            string   userAgent = "";
            var      ip        = GetIPAddress();

            if (Request.Headers.Contains("User-Agent"))
            {
                var headers = Request.Headers.GetValues("User-Agent");
                var sb      = new System.Text.StringBuilder();
                foreach (var header in headers)
                {
                    sb.Append(header);
                    // Re-add spaces stripped when user agent string was split up.
                    sb.Append(" ");
                }
                userAgent = sb.ToString().Trim();
            }

            var rslt = new AuthBLL().Login(param.name, param.password, userAgent, ip, out token);

            if (rslt == ERROR_CODE.SUCCESS)
            {
                return(ResultSuccess(token));
            }
            return(ResultError(rslt));
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (id != null)
            {
                if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanDelete == false)  // 权限验证
                {
                    Response.End();
                    return;
                }
                crm_account = new CompanyBLL().GetCompany(Convert.ToInt64(id));
                dic         = companyBll.GetField();
                if (crm_account != null)
                {
                    contactList     = new ContactBLL().GetContactByCompany(crm_account.id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany(crm_account.id);
                    todoList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id, (int)DicEnum.ACTIVITY_CATE.TODO);
                    noteList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id);
                    insProList      = new DAL.crm_installed_product_dal().FindByAccountId(crm_account.id);
                }
                else
                {
                    Response.End();
                }
            }
            else
            {
                Response.End();
            }
        }
        protected void HandleClickRegister(object sender, EventArgs e)
        {
            string name            = tbName.Text.Trim();
            string email           = tbEmail.Text.Trim();
            string password        = tbPassword.Text.Trim();
            string confirmPassword = tbConfirmPassword.Text.Trim();

            if (!password.Equals(confirmPassword))
            {
                lbError.Text = "Incorect confirm password";
                return;
            }

            ResponseRegisterDTO result = AuthBLL.Register(new UsersDTO
            {
                Name     = name,
                Email    = email,
                Password = password,
                Role     = Role.Employee
            });

            if (!result.Success)
            {
                lbError.Text = result.Error;
            }
            else
            {
                Response.Redirect("/login");
            }
        }
Beispiel #7
0
        public ApiResultDto GetRefreshToken(string refresh_token)
        {
            TokenDto token;
            var      rslt = new AuthBLL().RefreshToken(refresh_token, out token);

            if (rslt)
            {
                return(ResultSuccess(token));
            }
            return(ResultError(ERROR_CODE.PARAMS_ERROR));
        }
Beispiel #8
0
        /// <summary>
        /// 删除附件
        /// </summary>
        /// <param name="context"></param>
        private void DeleteAttachment(HttpContext context)
        {
            long id = long.Parse(context.Request.QueryString["id"]);

            if (AuthBLL.GetUserAttAuth(LoginUserId, LoginUser.security_Level_id, id).CanDelete == false)
            {
                context.Response.Write(new Tools.Serialize().SerializeJson(false));
                return;
            }
            bll.DeleteAttachment(id, LoginUserId);
            context.Response.Write(new Tools.Serialize().SerializeJson(true));
        }
Beispiel #9
0
 /// <summary>
 /// The constructor of the Auth controller.
 /// </summary>
 public AuthController(
     IConfiguration configuration,
     ILogger <AuthController> logger,
     IMapper mapper,
     AuthBLL bll
     )
 {
     this.configuration = configuration;
     this.logger        = logger;
     this.mapper        = mapper;
     this.bll           = bll;
 }
Beispiel #10
0
        /// <summary>
        /// 更改销售订单的状态
        /// </summary>
        /// <param name="context"></param>
        /// <param name="soid"></param>
        /// <param name="status_id"></param>
        private void ChangeSaleOrderStatus(HttpContext context, long soid, int status_id)
        {
            if (status_id == 469)
            {
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, soid).CanDelete == false)
                {
                    return;
                }
            }
            var result = new SaleOrderBLL().UpdateSaleOrderStatus(soid, status_id, LoginUserId);

            context.Response.Write(result);
        }
Beispiel #11
0
        /// <summary>
        /// 删除商机处理
        /// </summary>
        /// <param name="context"></param>
        /// <param name="opportunity_id"></param>
        public void DeleteOpportunity(HttpContext context, long opportunity_id)
        {
            if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, opportunity_id).CanDelete == false)
            {
                return;
            }

            var result = new OpportunityBLL().DeleteOpportunity(opportunity_id, LoginUserId);

            if (result)
            {
                context.Response.Write("删除商机成功!");
            }
            else
            {
                context.Response.Write("删除商机失败!");
            }
        }
Beispiel #12
0
        /// <summary>
        /// 删除报价
        /// </summary>
        /// <param name="context"></param>
        /// <param name="quote_id"></param>

        public void DeleteQuote(HttpContext context, long quote_id)
        {
            if (AuthBLL.GetUserQuoteAuth(LoginUserId, LoginUser.security_Level_id, quote_id).CanDelete == false)
            {
                return;
            }

            var result = new QuoteBLL().DeleteQuote(quote_id, LoginUserId);
            if (result)
            {
                context.Response.Write("删除报价成功!");
            }
            else
            {
                context.Response.Write("删除报价失败!");
            }

        }
Beispiel #13
0
        public ActionResult logout()
        {
            User login = AuthBLL.GetUser();

            if (login != null)
            {
                Session.Abandon();
                HttpCookie ck = Response.Cookies["usr"];
                if (ck != null)
                {
                    ck.Expires = DateTime.Now.AddDays(-1);
                }

                Session["GuvenlikKodu"] = null;
                Session["kullanici"]    = null;
            }
            return(RedirectToAction("Welcome", "Login", new { area = "admin" }));
        }
Beispiel #14
0
        /// <summary>
        /// 删除联系人的事件
        /// </summary>
        /// <param name="context"></param>
        /// <param name="contact_id"></param>
        public void DeleteContact(HttpContext context, long contact_id)
        {
            if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, contact_id).CanDelete == false)
            {
                return;
            }

            var result = new ContactBLL().DeleteContact(contact_id, LoginUserId);

            if (result)
            {
                context.Response.Write("删除联系人成功!");
            }
            else
            {
                context.Response.Write("删除联系人失败!");
            }
        }
Beispiel #15
0
        public void ProcessRequest(HttpContext ctx)
        {
            //userInfo = context.Session["dn_session_user_info"] as UserInfoDto;
            //if (userInfo == null)   // 用户未登录
            //{
            //    context.Response.Write(new Tools.Serialize().SerializeJson("{\"status\": '1', \"msg\": \"用户未登录!\"}"));
            //    context.Response.End();
            //    return;
            //}
            //userPermit = context.Session["dn_session_user_permits"] as List<AuthPermitDto>;

            string token = EMT.Tools.Common.GetCookie("Token", "DoneNOW");

            if (string.IsNullOrEmpty(token))
            {
                ctx.Response.Write(new Tools.Serialize().SerializeJson(new string[] { "status=1", "用户未登录" }));
                ctx.Response.End();
                return;
            }

            userInfo = AuthBLL.GetLoginUserInfo(token);
            if (userInfo == null)
            {
                ctx.Response.Write(new Tools.Serialize().SerializeJson(new string[] { "status=1", "用户未登录" }));
                ctx.Response.End();
                return;
            }
            userPermit = AuthBLL.GetLoginUserPermit(token);


            // 判断用户是否可以访问当前url
            if (!CheckUserAccess(ctx.Request.RawUrl))
            {
                ctx.Response.Write(new Tools.Serialize().SerializeJson(new string[] { "status=2", "没有权限操作" }));
                ctx.Response.End();
                return;
            }

            request  = ctx.Request;
            response = ctx.Response;

            AjaxProcess(ctx);
        }
Beispiel #16
0
        private bool IsUserLogin()
        {
            /*
             * //sys_user user = new sys_user { id = 1, email = "*****@*****.**", name="刘海", mobile_phone = "18217750743" };
             * //sys_user user = new sys_user { id = 2, email = "*****@*****.**", name = "朱飞", mobile_phone = "12" };
             * //Session["dn_session_user_info"] = user;
             * if (Session["dn_session_user_info"] != null)
             * {
             *  userInfo = Session["dn_session_user_info"] as UserInfoDto;
             *  userPermit = Session["dn_session_user_permits"] as List<AuthPermitDto>;
             *  return true;
             * }
             * else
             * {
             *  //检查Cookies
             *  string username = EMT.Tools.Common.GetCookie("UserName", "DoneNOW");
             *  string userpwd = EMT.Tools.Common.GetCookie("UserPwd", "DoneNOW");
             *  if (username != "" && userpwd != "")
             *  {
             *      // TODO: 验证用户名密码
             *      return false;
             *  }
             * }
             */

            string token = EMT.Tools.Common.GetCookie("Token", "DoneNOW");

            if (string.IsNullOrEmpty(token))
            {
                return(false);
            }

            userInfo = AuthBLL.GetLoginUserInfo(token);
            if (userInfo == null)
            {
                return(false);
            }

            userPermit = AuthBLL.GetLoginUserPermit(token);

            return(true);
        }
Beispiel #17
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            bool     isLogin;
            User     user    = new User();
            IAuthBLL authBLL = new AuthBLL();

            isLogin = authBLL.Login(txtUser.Text, txtPassword.Text, ref user);

            if (isLogin)
            {
                Program.user = user;
                MessageBox.Show("Berhasil Login");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("User Name atau Password Salah");
            }
        }
Beispiel #18
0
 public Form_DangNhap()
 {
     InitializeComponent();
     authBLL = new AuthBLL();
 }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                var soid = Request.QueryString["id"];
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(soid)).CanEdit == false)
                {
                    Response.End();
                    return;
                }

                sale_order = new crm_sales_order_dal().GetSingleSalesOrderByWhere($" and id = {soid}");
                if (sale_order != null)
                {
                    sale_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SALES);
                    sale_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SALES, sale_order.id, sale_udfList);
                    opportunity       = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id);
                    if (!IsPostBack)
                    {
                        var contactList = new crm_contact_dal().GetContactByAccountId(opportunity.account_id);


                        #region  拉赋值
                        status_id.DataTextField  = "show";
                        status_id.DataValueField = "val";
                        status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sales_order_status").Value;
                        status_id.DataBind();
                        status_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });

                        owner_resource_id.DataTextField  = "show";
                        owner_resource_id.DataValueField = "val";
                        owner_resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                        owner_resource_id.DataBind();
                        owner_resource_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });

                        // bill_country_id
                        bill_country_id.DataTextField  = "show";
                        bill_country_id.DataValueField = "val";
                        bill_country_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "country").Value;
                        bill_country_id.DataBind();
                        bill_country_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        bill_country_id.SelectedValue = "1";

                        ship_country_id.DataTextField  = "show";
                        ship_country_id.DataValueField = "val";
                        ship_country_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "country").Value;
                        ship_country_id.DataBind();
                        ship_country_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        ship_country_id.SelectedValue = "1";
                        // contact_id
                        contact_id.DataTextField  = "name";
                        contact_id.DataValueField = "id";
                        contact_id.DataSource     = contactList.Where(_ => _.is_active == 1).ToList();
                        contact_id.DataBind();
                        contact_id.Items.Insert(0, new ListItem()
                        {
                            Value = "0", Text = "   ", Selected = true
                        });
                        if (sale_order.contact_id != null)
                        {
                            contact_id.SelectedValue = sale_order.contact_id.ToString();
                        }

                        #endregion
                        billTo_use_account_address.Checked = sale_order.bill_to_use_account_address == 1;
                        shipTo_use_account_address.Checked = sale_order.ship_to_use_account_address == 1;
                        shipTo_use_bill_to_address.Checked = sale_order.ship_to_use_bill_to_address == 1;

                        status_id.SelectedValue         = sale_order.status_id.ToString();
                        owner_resource_id.SelectedValue = sale_order.owner_resource_id.ToString();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            actionTypeList = bll.GetCRMActionType();
            resourceList   = new UserResourceBLL().GetResourceList();

            if (!IsPostBack)
            {
                long noteid;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out noteid))
                {
                    if (AuthBLL.GetUserTodoAuth(LoginUserId, LoginUser.security_Level_id, noteid).CanEdit == false)
                    {
                        Response.Write("<script>alert('您不能编辑此待办');</script>");
                        Response.End();
                        return;
                    }

                    note            = bll.GetActivity(noteid);
                    contactList     = new ContactBLL().GetContactByCompany((long)note.account_id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany((long)note.account_id);
                    #region 记录浏览历史
                    var accountName = "";
                    if (note.account_id != null)
                    {
                        var account = new CompanyBLL().GetCompany((long)note.account_id);
                        accountName = account == null ? "" : account.name;
                    }
                    var history = new sys_windows_history()
                    {
                        title = "待办:" + note.description + ":" + accountName,
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }

                if (long.TryParse(Request.QueryString["accountId"], out accountId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.CUSTOMER;
                    objId   = accountId;
                }
                if (long.TryParse(Request.QueryString["contactId"], out contactId))
                {
                    accountId = new ContactBLL().GetContact(contactId).account_id;
                    objType   = (int)DicEnum.OBJECT_TYPE.CONTACT;
                    objId     = contactId;
                }
                if (long.TryParse(Request.QueryString["opportunityId"], out opportunityId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.OPPORTUNITY;
                    objId   = opportunityId;
                    var opp = new OpportunityBLL().GetOpportunity(opportunityId).general;
                    accountId = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
                if (long.TryParse(Request.QueryString["saleorderId"], out saleOrderId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.SALEORDER;
                    objId   = saleOrderId;
                    var saleOrder = new SaleOrderBLL().GetSaleOrder(saleOrderId);
                    var opp       = new OpportunityBLL().GetOpportunity(saleOrder.opportunity_id).general;
                    opportunityId = opp.id;
                    accountId     = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
                if (long.TryParse(Request.QueryString["ticketId"], out ticketId))
                {
                    objType   = (int)DicEnum.OBJECT_TYPE.TICKETS;
                    objId     = ticketId;
                    ticket    = new DAL.sdk_task_dal().FindNoDeleteById(ticketId);
                    accountId = ticket.account_id;
                    if (ticket.contact_id != null)
                    {
                        contactId = (long)ticket.contact_id;
                    }
                    if (ticket.opportunity_id != null)
                    {
                        opportunityId = (long)ticket.opportunity_id;
                    }
                }
            }
            else
            {
                com_activity activity = AssembleModel <com_activity>();
                if (activity.contact_id == 0)
                {
                    activity.contact_id = null;
                }
                activity.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date2"]));
                activity.end_date   = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date2"]));

                if (!string.IsNullOrEmpty(Request.Form["is_completed"]) && Request.Form["is_completed"].Equals("on"))
                {
                    activity.status_id     = (int)DicEnum.ACTIVITY_STATUS.COMPLETED;
                    activity.complete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["complete_time1"]));
                }
                else
                {
                    activity.status_id            = (int)DicEnum.ACTIVITY_STATUS.NOT_COMPLETED;
                    activity.complete_description = null;
                }

                if (string.IsNullOrEmpty(Request.Form["id"]))
                {
                    bll.AddTodo(activity, GetLoginUserId());
                }
                else
                {
                    bll.EditTodo(activity, GetLoginUserId());
                }

                if (Request.Form["action"] != null && Request.Form["action"].Equals("SaveNew"))
                {
                    Response.Write("<script>alert('保存待办成功');window.location.href='Notes.aspx';self.opener.location.reload();</script>");
                }
                else
                {
                    Response.Write("<script>alert('保存待办成功');window.close();self.opener.location.reload();</script>");
                }
            }
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(id));
                if (thisProject != null)
                {
                    //  校验 是否有权限进行查看
                    if (AuthBLL.GetUserProjectAuth(LoginUserId, LoginUser.security_Level_id, thisProject.id).CanView == false)
                    {
                        Response.Write("<script>alert('无权查看');window.close();</script>");
                        Response.End();
                        return;
                    }
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);


                    var thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
                    ShowTitle.Text = "项目-" + thisProject.no + thisProject.name + "(" + thisAccount.name + ")";
                    var type = Request.QueryString["type"];
                    switch (type)
                    {
                    case "Schedule":
                        viewProjectIframe.Src = "ProjectSchedule?project_id=" + thisProject.id;
                        break;

                    case "ScheduleTemp":
                        viewProjectIframe.Src = "ProjectSchedule?project_id=" + thisProject.id + "&isTranTemp=1";
                        break;

                    case "Team":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_TEAM + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_TEAM;
                        break;

                    case "Cost":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_COST_EXPENSE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_COST_EXPENSE + "&isCheck=1";
                        break;    // project_cost_expense

                    case "Note":
                        viewProjectIframe.Src = "ProjectNoteShow?project_id=" + thisProject.id;
                        break;

                    case "Rate":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_RATE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_RATE;
                        break;

                    case "Calendar":
                        //viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_CALENDAR + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_CALENDAR; project_udf
                        viewProjectIframe.Src = "ProjectCalendarShow?project_id=" + thisProject.id;
                        break;

                    case "Attach":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_ATTACH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_ATTACH;
                        break;

                    case "UDF":
                        viewProjectIframe.Src = "../Common/SearchBodyFrame.aspx?id=" + thisProject.id + "&cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_UDF + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_UDF;
                        break;

                    case "ticket":
                        viewProjectIframe.Src = "../Common/SearchFrameSet.aspx?cat=" + (int)DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)QueryType.MY_QUEUE_ACTIVE + "&group=215&param1=4890&param2=" + thisProject.id + "&param4=AddHidden";
                        break;

                    default:
                        viewProjectIframe.Src = "ProjectSummary?id=" + thisProject.id;
                        break;
                    }

                    #region 记录浏览历史
                    var history = new sys_windows_history()
                    {
                        title = $"项目:" + thisProject.name + " " + (thisAccount != null? thisAccount.name:""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];

                if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanView == false)
                {
                    Response.End();
                    return;
                }

                opportunity = new crm_opportunity_dal().GetOpportunityByOtherId(Convert.ToInt64(id));
                type        = Request.QueryString["type"];

                if (opportunity != null)
                {
                    dic       = new OpportunityBLL().GetField();
                    quoteList = new crm_quote_dal().GetQuoteByOpportunityId(opportunity.id);
                    account   = new CompanyBLL().GetCompany(opportunity.account_id);
                    if (opportunity.contact_id != null)
                    {
                        contact = new ContactBLL().GetContact((long)opportunity.contact_id);
                    }
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + opportunity.id, LoginUserId);



                    switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                    {
                    case "todo":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con660=" + opportunity.id + "&param1=opportunityId&param2=" + opportunity.id;                                  // 待办
                        actType   = "待办";
                        break;

                    case "note":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con647=" + opportunity.id + "&param1=opportunityId&param2=" + opportunity.id;                                 // 备注
                        actType   = "备注";
                        break;

                    case "activity":
                        iframeSrc = "";                                  // 活动
                        actType   = "活动";
                        break;

                    case "ticket":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5603=" + opportunity.id + "&param1=ShowPara";
                        actType   = "工单";
                        break;

                    case "quoteItem":
                        var oppoQuoteList = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {opportunity.id} ");

                        if (oppoQuoteList != null && oppoQuoteList.Count > 0)
                        {
                            iframeSrc        = "../QuoteItem/QuoteItemManage?isShow=show&opportunity_id=" + opportunity.id; // 报价项
                            isAddQuote.Value = "0";
                        }
                        else
                        {
                            isAddQuote.Value = "1";
                            //ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>if(confirm('商机尚未创建报价,需要现在创建吗?')){window.open('../Quote/QuoteAddAndUpdate.aspx?quote_opportunity_id=" + opportunity.id + "', '" + (int)EMT.DoneNOW.DTO.OpenWindow.QuoteAdd + "', 'left=200,top=200,width=960,height=750', false);}</script>");
                            //Response.Write("<script>debugger;</script>");
                        }

                        actType = "报价项";
                        break;

                    case "att":
                        iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_VIEW_ATTACHMENT + "&type=" + (int)QueryType.OpportunityViewAttachment + "&con976=" + opportunity.id;
                        actType   = "附件";
                        break;

                    default:
                        iframeSrc = "";      // 默认
                        actType   = "活动";
                        type      = "activity";
                        break;
                    }
                    if (type == "activity" || type == "note" || type == "todo")
                    {
                        isHide.Value = "show";
                    }
                    if (type.Equals("activity"))
                    {
                        var typeList = new ActivityBLL().GetCRMActionType();
                        noteType.DataSource     = typeList;
                        noteType.DataTextField  = "name";
                        noteType.DataValueField = "id";
                        noteType.DataBind();
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark  = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                callBackFiled = Request.QueryString["callBackFiled"];

                var opportunity_id = Request.QueryString["opportunity_id"];
                if (!string.IsNullOrEmpty(opportunity_id))
                {
                    if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(opportunity_id)).CanEdit == false)
                    {
                        Response.End();
                        return;
                    }

                    opportunity = new crm_opportunity_dal().GetOpportunityById(Convert.ToInt64(opportunity_id));
                }
                dic = new OpportunityBLL().GetField();

                #region 配置下拉框的数据源
                // 商机负责人
                resource_id.DataTextField  = "show";
                resource_id.DataValueField = "val";
                resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                resource_id.DataBind();
                resource_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 当前阶段
                stage_id.DataTextField  = "show";
                stage_id.DataValueField = "val";
                stage_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value;
                stage_id.DataBind();
                stage_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                stage_id.SelectedValue = ((int)OPPORTUNITY_STAGE.NEW_CLUE).ToString();
                // 感兴趣等级
                interest_degree_id.DataTextField  = "show";
                interest_degree_id.DataValueField = "val";
                interest_degree_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_interest_degree").Value;
                interest_degree_id.DataBind();
                interest_degree_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 商机来源
                source_id.DataTextField  = "show";
                source_id.DataValueField = "val";
                source_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_source").Value;
                source_id.DataBind();
                source_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 状态
                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_status").Value;
                status_id.DataBind();
                status_id.SelectedValue = ((int)OPPORTUNITY_STATUS.ACTIVE).ToString();
                //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                // 主要竞争对手
                competitor_id.DataTextField  = "show";
                competitor_id.DataValueField = "val";
                competitor_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
                competitor_id.DataBind();
                competitor_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 赢单原因
                win_reason_type_id.DataTextField  = "show";
                win_reason_type_id.DataValueField = "val";
                win_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value;
                win_reason_type_id.DataBind();
                win_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 丢单原因
                loss_reason_type_id.DataTextField  = "show";
                loss_reason_type_id.DataValueField = "val";
                loss_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_loss_reason_type").Value;
                loss_reason_type_id.DataBind();
                loss_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // 通知模板   --todo 需要过滤商机创建或编辑相关的通知模板
                //notify_tmpl_id.DataTextField = "show";
                //notify_tmpl_id.DataValueField = "val";
                //notify_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "notify_tmpl").Value;
                //notify_tmpl_id.DataBind();
                //notify_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });


                var formTemplateList = new FormTemplateBLL().GetTemplateOpportunityByUser(GetLoginUserId());
                formTemplate.DataTextField  = "speed_code";
                formTemplate.DataValueField = "id";
                formTemplate.DataSource     = formTemplateList;
                formTemplate.DataBind();
                formTemplate.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                #endregion


                opportunity_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.OPPORTUNITY);
                if (opportunity != null)
                {
                    isAdd = false;

                    //company_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY);
                }

                if (!isAdd)
                {
                    opportunity_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.OPPORTUNITY, opportunity.id, opportunity_udfList);
                    if (!IsPostBack)
                    {
                        resource_id.SelectedValue         = opportunity.resource_id.ToString();
                        stage_id.SelectedValue            = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString();
                        interest_degree_id.SelectedValue  = opportunity.interest_degree_id == null ? "0" : opportunity.interest_degree_id.ToString();
                        source_id.SelectedValue           = opportunity.source_id == null ? "0" : opportunity.source_id.ToString();
                        status_id.SelectedValue           = opportunity.status_id == null ? "0" : opportunity.status_id.ToString();
                        competitor_id.SelectedValue       = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString();
                        win_reason_type_id.SelectedValue  = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString();
                        loss_reason_type_id.SelectedValue = opportunity.loss_reason_type_id == null ? "0" : opportunity.loss_reason_type_id.ToString();


                        is_use_quote.Checked = opportunity.use_quote == 1;
                    }
                }
                else
                {
                    //  联系人查看的时候穿过来客户ID,和联系人ID,联系人不能更改,只有更改客户才可以更改联系人
                    var contact_id = Request.QueryString["oppo_contact_id"];
                    if (!string.IsNullOrEmpty(contact_id))
                    {
                        contact = new ContactBLL().GetContact(Convert.ToInt64(contact_id));
                    }

                    var account_id = Request.QueryString["oppo_account_id"];
                    if (!string.IsNullOrEmpty(account_id))
                    {
                        account = new CompanyBLL().GetCompany(Convert.ToInt64(account_id));
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // todo - 商机的重新指派

                var sid = Request.QueryString["id"];
                if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(sid)).CanView == false)
                {
                    Response.End();
                    return;
                }
                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + sid, LoginUserId);

                type        = Request.QueryString["type"];
                sale_order  = new crm_sales_order_dal().GetSingleSale(long.Parse(sid));
                opportunity = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id);
                account     = new CompanyBLL().GetCompany(opportunity.account_id);
                quote       = new QuoteBLL().GetPrimaryQuote(opportunity.id);
                if (sale_order.contact_id != null)
                {
                    contact = new ContactBLL().GetContact((long)sale_order.contact_id);
                }
                switch (type)
                {
                case "activity":
                    actType          = "活动";
                    isShowLeft.Value = "1";
                    break;

                case "todo":
                    actType          = "待办";
                    iframeSrc        = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=131&con676=" + sale_order.id + "&param1=saleorderId&param2=" + sale_order.id;
                    isShowLeft.Value = "1";
                    break;

                case "note":
                    actType          = "备注";
                    iframeSrc        = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=129&con675=" + sale_order.id + "&param1=saleorderId&param2=" + sale_order.id;
                    isShowLeft.Value = "1";
                    break;

                case "ticket":
                    actType = "工单";
                    break;

                case "attachment":
                    actType   = "附件";
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SALES_ORDER_VIEW_ATTACHMENT + "&type=" + (int)QueryType.SalesOrderViewAttachment + "&con977=" + sale_order.id;
                    break;

                case "entry":
                    actType   = "报价项";
                    iframeSrc = "../QuoteItem/QuoteItemManage.aspx?isShow=1&quote_id=" + quote.id + "&isSaleOrder=1&sale_order_id=" + sale_order.id;
                    break;

                case "purchaseOrder":
                    actType = "采购订单";
                    break;

                default:
                    actType          = "活动";
                    type             = "activity";
                    isShowLeft.Value = "1";
                    break;
                }

                if (type.Equals("activity"))
                {
                    var typeList = new ActivityBLL().GetCRMActionType();
                    noteType.DataSource     = typeList;
                    noteType.DataTextField  = "name";
                    noteType.DataValueField = "id";
                    noteType.DataBind();
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #25
0
 /// <summary>
 /// 判断用户是否有权限访问当前url
 /// </summary>
 /// <returns></returns>
 private bool CheckUserAccess(string url)
 {
     //return true;
     return(AuthBLL.CheckUrlAuth(userInfo.security_Level_id, userPermit, url));
 }
Beispiel #26
0
 /// <summary>
 /// 获取一个limit权限值
 /// </summary>
 /// <param name="limit"></param>
 /// <returns></returns>
 protected DicEnum.LIMIT_TYPE_VALUE GetLimitValue(AuthLimitEnum limit)
 {
     return(AuthBLL.GetLimitValue(userInfo.security_Level_id, limit));
 }
Beispiel #27
0
 /// <summary>
 /// 判断是否有对应权限
 /// </summary>
 /// <param name="sn"></param>
 /// <returns></returns>
 protected bool CheckAuth(string sn)
 {
     //return true;
     return(AuthBLL.CheckAuth(userInfo.security_Level_id, userPermit, sn));
 }
Beispiel #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // var account_id = Request.QueryString["account_id"];      // 客户ID
                var contact_id = Request.QueryString["id"];      // 联系人ID

                if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(contact_id)).CanView == false)
                {
                    Response.End();
                    return;
                }

                contact      = contactBLL.GetContact(Convert.ToInt64(contact_id));
                thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + Convert.ToInt64(contact_id), LoginUserId);
                if (contact != null)
                {
                    account = companyBll.GetCompany(contact.account_id);
                }
                type = Request.QueryString["type"];
                if (string.IsNullOrEmpty(type))
                {
                    type = "activity";
                }
                if (type == "activity" || type == "note" || type == "todo")
                {
                    isHide.Value = "show";
                }
                switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                {
                case "activity":
                    actType = "活动";
                    break;

                case "todo":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con659=" + contact_id + "&param1=contactId&param2=" + contact_id;      // 待办
                    actType   = "待办";
                    break;

                case "note":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con646=" + contact_id + "&param1=contactId&param2=" + contact_id;      // 备注
                    actType   = "备注";
                    break;

                case "opportunity":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_CONTACT_VIEW + "&type=" + (int)QueryType.OpportunityContactView + "&id=" + contact_id;      // 商机
                    actType   = "商机";
                    break;

                case "configura":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.INSTALLEDPRODUCT + "&type=" + (int)QueryType.InstalledProductView + "&con966=" + contact_id;
                    actType   = "配置项";
                    break;

                case "ticket":
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5602=" + contact_id + "&param1=ShowPara";
                    actType   = "工单";
                    break;

                case "group":
                    actType   = "联系人组";
                    iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_CONTACT_GROUP_SEARCH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_CONTACT_GROUP_SEARCH;      // todo 添加参数
                    break;

                default:
                    iframeSrc = "";      // 默认
                    break;
                }
                if (type.Equals("activity"))
                {
                    var typeList = new ActivityBLL().GetCRMActionType();
                    noteType.DataSource     = typeList;
                    noteType.DataTextField  = "name";
                    noteType.DataValueField = "id";
                    noteType.DataBind();
                }
                if (account != null && contact != null)
                {
                    dic                 = new CompanyBLL().GetField();
                    contactUDFList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT);
                    contactEDFValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTACT, contact.id, contactUDFList);
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #29
0
        // 点击登录
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = uname.Text.Trim();
            string userPwd  = pswd.Text.Trim();
            string pwdMd5   = new Cryptographys().MD5Encrypt(userPwd);

            string ip    = DNRequest.GetIP();
            string agent = HttpContext.Current.Request.UserAgent;
            var    bll   = new AuthBLL();

            TokenDto token  = new TokenDto();
            var      result = bll.Login(userName, userPwd, agent, ip, out token);

            if (result == ERROR_CODE.SUCCESS)
            {
                Common.WriteCookie("Token", "DoneNOW", token.token);
                Application["isFromLogin"] = "******";
                Response.Redirect("index.aspx");
            }
            else
            {
                if (result == ERROR_CODE.PARAMS_ERROR)
                {
                    msgtip.InnerHtml = "请使用邮箱或手机号登录!";
                }
                if (result == ERROR_CODE.PASSWORD_ERROR)
                {
                    msgtip.InnerHtml = "密码错误!";
                }
                if (result == ERROR_CODE.USER_NOT_FIND)
                {
                    msgtip.InnerHtml = "输入用户不存在!";
                }
                if (result == ERROR_CODE.LOCK)
                {
                    msgtip.InnerHtml = "您的账户已被锁定,登录失败";
                }
                msgtip.Visible = true;
            }

            /*
             * var result = bll.Login(userName, userPwd, ip, agent, out user);
             * if (result== DTO.ERROR_CODE.SUCCESS)
             * {
             *  Session["dn_session_user_info"] = user;
             *  Session["dn_session_user_permits"] = bll.GetUserPermit(user.id);
             *  EMT.Tools.Common.WriteCookie("UserName", "DoneNOW", userName);
             *  EMT.Tools.Common.WriteCookie("UserPwd", "DoneNOW", pwdMd5);
             *  Response.Redirect("index.aspx");
             * }
             * else
             * {
             *  if (result == ERROR_CODE.PARAMS_ERROR)
             *      msgtip.InnerHtml = "请使用邮箱或手机号登录!";
             *  if (result == ERROR_CODE.PASSWORD_ERROR)
             *      msgtip.InnerHtml = "密码错误!";
             *  if (result == ERROR_CODE.USER_NOT_FIND)
             *      msgtip.InnerHtml = "输入用户不存在!";
             *  msgtip.Visible = true;
             * }
             */
        }
 public Form_DoiMatKhau()
 {
     InitializeComponent();
     authBLL = new AuthBLL();
 }