Esempio n. 1
0
    /// <summary>
    /// 保存个人信息
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    private long Save_Personal(dynamic data)
    {
        var s_personal = JsonConvert.SerializeObject(data.personal);

        CRMTree.Model.CT_All_Users personal = JsonConvert.DeserializeObject <CRMTree.Model.CT_All_Users>(s_personal);

        CRMTree.Model.CT_Drivers_List_New drivermodel = JsonConvert.DeserializeObject <CRMTree.Model.CT_Drivers_List_New>(s_personal);
        if (!string.IsNullOrWhiteSpace(personal.AU_Username))
        {
            if (CT_All_User.Exists("AU_Code != @0 and AU_Username = @1", personal.AU_Code, personal.AU_Username))
            {
                throw new Exception(Interna ? "User account already exists!" : "用户账号已存在!");
            }
        }
        if (string.IsNullOrWhiteSpace(personal.AU_Name))
        {
            throw new Exception(Interna ? "NOT NULL!" : "姓名不能为空!");
        }
        long?au_code = data.AU_Code;

        personal.AU_Update_dt = DateTime.Now;

        //更新个人资料
        CRMTree.BLL.BL_UserEntity bll = new CRMTree.BLL.BL_UserEntity();
        if (!string.IsNullOrWhiteSpace(personal.AU_Password))
        {
            if (!bll.ExistsPwd(personal.AU_Password, personal.AU_Username))
            {
                personal.AU_Password = ShInfoTech.Common.Security.Md5(personal.AU_Password);
            }
        }

        int isSuccess = 0;


        if (au_code != null) //添加
        {
            bll.Update_CT_All_Users(personal);
            drivermodel.MAU_Code = data.MAU_Code;
        }

        isSuccess = bll.add_personal(drivermodel);
        if (isSuccess > 0)
        {
            if (au_code == null)
            {
                au_code = bll.getMaxAU_Code();
            }
            return((long)au_code);
        }

        else
        {
            return(isSuccess);
        }
    }
    private void Get_Send_file(dynamic data)
    {
        int         _au_code    = (int)data.AU_Code;
        int         _ap_code    = (int)data.AP_Code;
        string      _au_Content = (string)data.Content;
        BL_Campaign _bl_cam     = new BL_Campaign();

        CRMTree.Model.CT_All_Users _o = _bl_cam.GetTXCam_Number(_au_code, _ap_code);
        if (_o != null && !string.IsNullOrEmpty(_o.PL_Number))
        {
            SendMessage.SendAppconfirm(Convert.ToString(_o.PL_Number), _au_Content);
            //SendMessage.SendAppconfirm(Convert.ToString("18516147361"), _au_Content);
        }
        Response.Write(1);
    }
    private void Get_view_file(dynamic data)
    {
        int         _au_code = (int)data.AU_Code;
        int         _ap_code = (int)data.AP_Code;
        BL_Campaign _bl_cam  = new BL_Campaign();

        CRMTree.Model.CT_Campaigns _o = _bl_cam.GetTXCam(UserSession.DealerEmpl.DE_UType, UserSession.DealerEmpl.DE_AD_OM_Code);

        string _fileCount = string.Empty;

        if (data.AU_Code != null && ((string)data.AU_Code) != "" && !string.IsNullOrEmpty(_o.CM_Filename))
        {
            List <CRMTreeDatabase.EX_Param> exParams = new List <CRMTreeDatabase.EX_Param>();
            exParams.Add(new CRMTreeDatabase.EX_Param()
            {
                EX_DataType = "int", EX_Name = "AU", EX_Value = (string)data.AU_Code
            });
            exParams.Add(new CRMTreeDatabase.EX_Param()
            {
                EX_DataType = "int", EX_Name = "AD", EX_Value = UserSession.DealerEmpl.DE_AD_OM_Code.ToString()
            });
            exParams.Add(new CRMTreeDatabase.EX_Param()
            {
                EX_DataType = "int", EX_Name = "AP", EX_Value = (string)data.AP_Code
            });
            _fileCount = BL_Reports.GetFileContent(_o.CM_Filename, exParams, 2);
        }
        _fileCount = Microsoft.JScript.GlobalObject.escape(_fileCount);
        CRMTree.Model.CT_All_Users _oo = _bl_cam.GetTXCam_Number(_au_code, _ap_code);
        string _pl_number = "";

        if (_oo != null && !string.IsNullOrEmpty(_oo.PL_Number))
        {
            _pl_number = _oo.PL_Number;
        }
        Response.Write(JsonConvert.SerializeObject(new { _con = _fileCount, _pl = _pl_number }));
    }