private void Get_CustomerName(int AU_Code) { var au = CT_All_User.SingleOrDefault(AU_Code); Response.Write(au.AU_Name); }
/// <summary> /// 获得员工信息 /// </summary> /// <param name="data"></param> private void Get_EmployeeInfo(dynamic data) { dynamic o = new ExpandoObject(); int Empl_Code = (int)data.Empl_Code; if (Empl_Code > 0) { //var empl = CT_Dealer_Empl.SingleOrDefault(Empl_Code); //o.dealerEmpl = new { // DE_Code = empl.DE_Code, // DE_ID = empl.DE_ID, // DE_Type = empl.DE_Type, // DE_Picture_FN_Temp = empl.DE_Picture_FN, // DE_Picture_FN = empl.DE_Picture_FN //}; var empl = CT_Dealer_Empl.SingleOrDefault(Empl_Code); empl.EX_DE_Activate_dt = empl.DE_Activate_dt.HasValue ? empl.DE_Activate_dt.Value.ToString(Interna ? "MM/dd/yyyy" : "yyyy-MM-dd") : ""; empl.EX_DE_Vacation_St = empl.DE_Vacation_St.HasValue ? empl.DE_Vacation_St.Value.ToString(Interna ? "MM/dd/yyyy" : "yyyy-MM-dd") : ""; empl.EX_DE_Vacation_En = empl.DE_Vacation_En.HasValue ? empl.DE_Vacation_En.Value.ToString(Interna ? "MM/dd/yyyy" : "yyyy-MM-dd") : ""; o.dealerEmpl = empl; var AU_Code = empl.DE_AU_Code; if (AU_Code > 0) { #region personal o.personal = CT_All_User.SingleOrDefault(@"select AU_Code, AU_Active_tag, AU_Name, AU_Username, AU_Dr_Lic, AU_Gender, AU_ID_Type, AU_ID_No, AU_Education, AU_Married, AU_Type, AU_UG_Code, --AU_Occupation, --AU_Industry, AU_B_date from CT_All_Users where AU_Code=@0", AU_Code); #endregion #region contacts o.contacts = new ExpandoObject(); var db = DBCRMTree.GetInstance(); var sql_text_part = Interna ? "[text_en]" : "[text_cn]"; var sql = string.Format(@"Select AL_Code,AL_Type,AL_Add1,AL_Add2,AL_District,AL_City ,AL_State,AL_Zip,AL_Pref as [pref] ,(select {0} from words where p_id = 55 and [value] = al_type) as AL_Type_Text FROM CT_Address_List WHERE AL_AU_AD_Code=@0 and isnull(AL_Active,1) = 1 ", sql_text_part); o.contacts.address = db.Query <dynamic>(sql, AU_Code); sql = string.Format(@"Select PL_Code,PL_Type,PL_Number,PL_pref as [pref] ,(select {0} from words where p_id = 47 and [value] = pl_type) as PL_Type_Text from CT_Phone_List WHERE PL_AU_AD_Code=@0 and isnull(PL_Active,1) = 1 ", sql_text_part); o.contacts.phone = db.Query <dynamic>(sql, AU_Code); sql = string.Format(@"Select EL_Code,EL_Type,EL_Address,EL_Pref as [pref] ,(select {0} from words where p_id = 44 and [value] = el_type) as EL_Type_Text from CT_eMail_List WHERE EL_AU_AD_Code=@0 and isnull(EL_Active,1) = 1 ", sql_text_part); o.contacts.email = db.Query <dynamic>(sql, AU_Code); sql_text_part = Interna ? "[MC_Name_EN]" : "[MC_Name_CN]"; sql = string.Format(@"Select ML_MC_Code,ML_Code,ML_Handle,ML_Pref as [pref] ,(SELECT {0} FROM [CT_Messaging_Carriers] where MC_Code=[ML_MC_Code]) as ML_MC_Code_Text from CT_Messaging_List WHERE ML_AU_AD_Code=@0 and isnull(ML_Active,1) = 1 ", sql_text_part); o.contacts.messaging = db.Query <dynamic>(sql, AU_Code); #endregion #region summary var dealer_code = 0; var user = HttpContext.Current.Session["PublicUser"] as MD_UserEntity; if (null != user && user.User.UG_UType == 1) { dealer_code = user.DealerEmpl.DE_AD_OM_Code; } if (dealer_code > 0) { db.EnableAutoSelect = false; o.summary = db.SingleOrDefault <dynamic>( "exec [CT_GetCustomerSummary] @Dealer_code,@User_code,@IsEn" , new { Dealer_code = dealer_code, User_code = AU_Code, IsEn = Interna } ); } #endregion o.schedule = Get_Schedule((int)data.DP_UType, (int)AU_Code); } } Response.Write(JsonConvert.SerializeObject(o)); }
/// <summary> /// 获得员工信息 /// </summary> /// <param name="data"></param> private void Get_AsscInfo(dynamic data) { dynamic o = new ExpandoObject(); // int Empl_Code = (int)data.AU_Code; // if (Empl_Code > 0) // { // var empl = CT_Dealer_Empl.SingleOrDefault(Empl_Code); // empl.EX_DE_Activate_dt = empl.DE_Activate_dt.HasValue ? empl.DE_Activate_dt.Value.ToString(Interna ? "MM/dd/yyyy" : "yyyy-MM-dd") : ""; // o.dealerEmpl = empl; var AU_Code = (int)data.AU_Code; var MAU_Code = (int)data.MAU_Code; if (AU_Code > 0) { #region personal o.personal = CT_All_User.SingleOrDefault(@"select AU_Code, AU_Active_tag, AU_Name, AU_Username, AU_Password, AU_Dr_Lic, AU_Gender, AU_ID_Type, AU_ID_No, AU_Education, AU_Married, AU_Type, AU_UG_Code, AU_Occupation, AU_Industry, AU_B_date from CT_All_Users where AU_Code=@0", AU_Code); #endregion #region Categories o.Categories = CT_Drivers_ListNew.SingleOrDefault(@"select distinct DL_Access as DL_Acc,DL_Relation as DL_Rel,DL_type,[dbo].[f_GetDL_CI_CodesByMAUCodeANDAU_Code](@1,@0) AS DL_CI_Codes from CT_Drivers_List where DL_AU_Code=@0 and DL_M_AU_Code=@1", AU_Code, MAU_Code); // o.Categories = new ExpandoObject(); var db = DBCRMTree.GetInstance(); // var sql = string.Format(@"select DL_Access,DL_Relation,DL_type, DL_CI_Code from CT_Drivers_List // where DL_AU_Code=@0 and DL_M_AU_Code=@1"); // o.Categories = db.Query<dynamic>(sql, AU_Code, MAU_Code); #endregion #region contacts o.contacts = new ExpandoObject(); var sql_text_part = Interna ? "[text_en]" : "[text_cn]"; var sql = string.Format(@"Select AL_Code,AL_Type,AL_Add1,AL_Add2,AL_District,AL_City ,AL_State,AL_Zip,AL_Pref as [pref] ,(select {0} from words where p_id = 55 and [value] = al_type) as AL_Type_Text FROM CT_Address_List WHERE AL_AU_AD_Code=@0 and isnull(AL_Active,1) = 1 ", sql_text_part); o.contacts.address = db.Query <dynamic>(sql, AU_Code); sql = string.Format(@"Select PL_Code,PL_Type,PL_Number,PL_pref as [pref] ,(select {0} from words where p_id = 47 and [value] = pl_type) as PL_Type_Text from CT_Phone_List WHERE PL_AU_AD_Code=@0 and isnull(PL_Active,1) = 1 ", sql_text_part); o.contacts.phone = db.Query <dynamic>(sql, AU_Code); sql = string.Format(@"Select EL_Code,EL_Type,EL_Address,EL_Pref as [pref] ,(select {0} from words where p_id = 44 and [value] = el_type) as EL_Type_Text from CT_eMail_List WHERE EL_AU_AD_Code=@0 and isnull(EL_Active,1) = 1 ", sql_text_part); o.contacts.email = db.Query <dynamic>(sql, AU_Code); sql_text_part = Interna ? "[MC_Name_EN]" : "[MC_Name_CN]"; sql = string.Format(@"Select ML_Type as ML_MC_Code,ML_Code,ML_Handle,ML_Pref as [pref] ,ISNULL((SELECT {0} FROM [CT_Messaging_Carriers] where MC_Code=[ML_Type]),'') as ML_MC_Code_Text from CT_Messaging_List WHERE ML_AU_AD_Code=@0 and isnull(ML_Active,1) = 1 ", sql_text_part); o.contacts.messaging = db.Query <dynamic>(sql, AU_Code); #endregion } // } Response.Write(JsonConvert.SerializeObject(o)); }