本文整理汇总了C#中GK.Library.Utility.SqlDataAccess类的典型用法代码示例。如果您正苦于以下问题:C# SqlDataAccess类的具体用法?C# SqlDataAccess怎么用?C# SqlDataAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlDataAccess类属于GK.Library.Utility命名空间,在下文中一共展示了SqlDataAccess类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SendSms
public SendSms()
{
InitializeComponent();
try
{
LOG_PATH = Globals.FileLogPath;
ERROR_LOG_PATH = Globals.FileLogPath;
_tokenSource = new CancellationTokenSource();
_token = _tokenSource.Token;
_timer = new System.Timers.Timer();
_timer.Interval = Convert.ToDouble(ConfigurationManager.AppSettings["serviceInterval"]);
_timer.AutoReset = true;
_timer.Enabled = true;
_timer.Elapsed += timer_Elapsed;
_sda = new SqlDataAccess();
_sda.openConnection(Globals.ConnectionString);
_service = MSCRM.GetOrgService(true);
_serviceProcess = new ServiceProcess(_sda, _service);
}
catch (Exception ex)
{
FileLogHelper.LogFunction(this.GetType().Name, "SendSms_SendSms_EXCEPTION:" + ex.Message, ERROR_LOG_PATH);
}
}
开发者ID:volkanytu,项目名称:Portal,代码行数:31,代码来源:SendSms.cs
示例2: CheckOldPasswordCorrect
public static MsCrmResult CheckOldPasswordCorrect(Guid portalUserId, string oldPassword, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
COUNT(0) AS RecCount
FROM
new_user AS u (NOLOCK)
WHERE
u.new_userId='{0}'
AND
u.new_password='{1}'";
#endregion
int recCount = (int)sda.ExecuteScalar(string.Format(sqlQuery, portalUserId, oldPassword.Trim()));
if (recCount > 0)
{
returnValue.Success = true;
returnValue.Result = "Eski şifre ile bilgiler eşleşti.";
}
else
{
returnValue.Result = "Eski şifre bilginiz yanlıştır.<br />Lütfen kontrol ediniz.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:34,代码来源:PortalUserHelper.cs
示例3: GetAnnotationDetail
public static Annotation GetAnnotationDetail(Guid annotationId, SqlDataAccess sda)
{
Annotation returnValue = new Annotation();
try
{
#region | SQL QUERY |
string query = @"SELECT
A.AnnotationId
,A.MimeType
,A.FileName
,A.DocumentBody
FROM
Annotation A
WHERE
A.AnnotationId = '{0}'";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, annotationId));
if (dt != null && dt.Rows.Count > 0)
{
returnValue.AnnotationId = (Guid)dt.Rows[0]["AnnotationId"];
returnValue.MimeType = dt.Rows[0]["MimeType"] != DBNull.Value ? dt.Rows[0]["MimeType"].ToString() : string.Empty;
returnValue.FileName = dt.Rows[0]["FileName"] != DBNull.Value ? dt.Rows[0]["FileName"].ToString() : string.Empty;
returnValue.File = dt.Rows[0]["DocumentBody"] != DBNull.Value ? dt.Rows[0]["DocumentBody"].ToString() : string.Empty;
}
}
catch (Exception)
{
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:32,代码来源:AnnotationHelper.cs
示例4: CheckPhoneNumberMatch
public static MsCrmResult CheckPhoneNumberMatch(string userName, string phoneNumber, string portalId, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
u.new_userId AS PortalUserId
,c.ContactId
,c.MobilePhone
FROM
new_user AS u (NOLOCK)
JOIN
new_new_user_new_role AS ur (NOLOCK)
ON
u.new_userId=ur.new_userid
JOIN
new_role AS r (NOLOCK)
ON
r.new_roleId=ur.new_roleid
AND
r.new_portalId='{2}'
JOIN
Contact AS c (NOLOCK)
ON
c.ContactId=u.new_contactId
WHERE
u.new_name='{0}'
AND
u.statecode=0
AND
u.statuscode=1 --Active
AND
c.MobilePhone='{1}'";
#endregion
DataTable dt = sda.getDataTable(string.Format(sqlQuery, userName, phoneNumber, portalId));
if (dt.Rows.Count > 0)
{
returnValue.Success = true;
returnValue.Result = dt.Rows[0]["ContactId"].ToString();
returnValue.CrmId = (Guid)dt.Rows[0]["PortalUserId"];
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:55,代码来源:PortalUserHelper.cs
示例5: GetToken
public MsCrmResult GetToken(string portalId, string userName, string password)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(portalId))
{
_sda = new SqlDataAccess();
_sda.openConnection(Globals.ConnectionString);
returnValue = LoginHelper.LoginControl(new Guid(portalId), userName, password, _sda);
//returnValue.Success = true;
if (returnValue.Success)
{
Guid systemUserId = returnValue.CrmId;
IOrganizationService service = MSCRM.GetOrgService(true);
string ipAddress = HttpContext.Current.Request.UserHostAddress;
MsCrmResult logResult = LoginHelper.LogLogIn(returnValue.CrmId, new Guid(portalId), DateTime.Now, ipAddress, service);
returnValue.Result = Guid.NewGuid().ToString().Replace("-", "");
MsCrmResult sessionResult = SetUserSession(returnValue.Result, new Guid(portalId), systemUserId);
if (!sessionResult.Success)
{
return sessionResult;
}
}
}
else
{
returnValue.Result = "Eksik Parametre.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
finally
{
if (_sda != null)
{
_sda.closeConnection();
}
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:53,代码来源:DiscoveryFormService.svc.cs
示例6: ServiceProcess
public ServiceProcess(SqlDataAccess sda, IOrganizationService service)
{
_sda = sda;
_service = service;
LOG_PATH = Globals.FileLogPath;
ERROR_LOG_PATH = Globals.FileLogPath;
SMTP_USERNAME = ConfigurationManager.AppSettings["username"].ToString();
SMTP_PASSWORD = ConfigurationManager.AppSettings["password"].ToString();
FROM_MAILADDRESS = ConfigurationManager.AppSettings["mailaddress"].ToString();
MAIL_HOST = ConfigurationManager.AppSettings["hostaddress"].ToString();
PORT = ConfigurationManager.AppSettings["port"].ToString();
}
开发者ID:volkanytu,项目名称:Portal,代码行数:14,代码来源:ServiceProcess.cs
示例7: GetArticleCategoryInfo
public static MsCrmResultObject GetArticleCategoryInfo(Guid categoryId, SqlDataAccess sda)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
try
{
#region | SQL QUERY |
string query = @"SELECT DISTINCT
E.new_articlecategoryId AS Id
,E.new_name Name
,E.new_portalId PortalId
,E.new_portalIdName PortalIdName
,E.new_imageurl AS ImageUrl
FROM
new_articlecategory AS E (NOLOCK)
WHERE
E.new_articlecategoryId = '{0}'
AND
E.statuscode=1 --Active";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, categoryId));
if (dt != null && dt.Rows.Count > 0)
{
EntityReference er = new EntityReference()
{
Id = (Guid)dt.Rows[0]["Id"],
Name = dt.Rows[0]["Name"].ToString(),
LogicalName = dt.Rows[0]["ImageUrl"] != DBNull.Value ? dt.Rows[0]["ImageUrl"].ToString() : "no_image_available.png"
};
returnValue.Success = true;
returnValue.ReturnObject = er;
}
else
{
returnValue.Success = false;
returnValue.Result = "M024";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:46,代码来源:ArticleHelper.cs
示例8: ConfirmForm
public MsCrmResult ConfirmForm(string token, int formCode)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
_sda = new SqlDataAccess();
_sda.openConnection(Globals.ConnectionString);
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
MsCrmResultObject resultFormInfo = DiscoveryFormHelper.GetDiscoveryFormInfo(formCode, _sda);
if (resultFormInfo.Success)
{
DiscoveryForm formInfo = (DiscoveryForm)resultFormInfo.ReturnObject;
formInfo.Status = new OptionSetValueWrapper() { AttributeValue = (int)DiscoveryFormStatus.LotusConfirmed };
}
else
{
returnValue.Result = resultFormInfo.Result;
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:46,代码来源:DiscoveryFormService.svc.cs
示例9: GetAllTowns
public static MsCrmResultObj<List<Town>> GetAllTowns(SqlDataAccess sda)
{
MsCrmResultObj<List<Town>> returnValue = new MsCrmResultObj<List<Town>>();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
t.new_townId AS Id
,t.new_name AS Name
,t.new_towncode AS Code
,t.new_cityId AS CityId
,t.new_cityIdName AS CityIdName
,'new_city' AS CityIdTypeName
FROM
new_town AS t (NOLOCK)
JOIN
new_city AS c (NOLOCK)
ON
t.new_cityId=c.new_cityId";
#endregion
DataTable dt = sda.getDataTable(string.Format(sqlQuery));
if (dt.Rows.Count > 0)
{
List<Town> townList = dt.ToList<Town>();
returnValue.Success = true;
returnValue.ReturnObject = townList;
}
else
{
returnValue.Result = "Kayıt bulunamadı.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
returnValue.HasException = true;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:46,代码来源:LocationHelper.cs
示例10: GetPointCodeInfo
public static MsCrmResultObject GetPointCodeInfo(string code, SqlDataAccess sda)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
pc.new_pointcodeId AS Id
,pc.new_name AS Name
,pc.new_portalid AS PortalId
,pc.new_portalidName AS PortalIdName
,'new_portal' AS PortalIdTypeName
,pc.new_group AS GroupCode
,pc.new_code AS Code
,pc.new_point AS Point
,pc.statuscode AS Status
FROM
new_pointcode AS pc (NOLOCK)
WHERE
pc.new_code='{0}'";
#endregion
DataTable dt = sda.getDataTable(string.Format(sqlQuery, code));
if (dt.Rows.Count > 0)
{
List<PointCode> pCode = dt.ToList<PointCode>();
returnValue.Success = true;
returnValue.ReturnObject = pCode[0];
}
else
{
returnValue.Result = "Kod bulunamadı.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:46,代码来源:PointCodeHelper.cs
示例11: CheckIsUserYourFriend
public static MsCrmResult CheckIsUserYourFriend(Guid portalId, Guid portalUserId, Guid selectedUserId, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string query = @"SELECT
f.new_friendshipId AS Id
FROM
new_friendship AS f (NOLOCK)
WHERE
f.new_portalId='{0}'
AND
f.statecode=0
AND
(
(f.new_partyoneId='{1}' AND f.new_partytwoId='{2}')
OR
(f.new_partyoneId='{2}' AND f.new_partytwoId='{1}')
)";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, portalId, portalUserId, selectedUserId));
if (dt != null && dt.Rows.Count > 0)
{
returnValue.Success = true;
returnValue.CrmId = (Guid)dt.Rows[0]["Id"];
}
else
{
returnValue.Success = false;
returnValue.Result = "M039"; //"Kullanıcı arkadaşınız değildir!";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:42,代码来源:FriendshipHelper.cs
示例12: GetPortalId
public static MsCrmResult GetPortalId(string url, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string query = @"SELECT
u.new_portalId AS BrandId
FROM
new_portalurl AS u (NOLOCK)
JOIN
new_portal AS b (NOLOCK)
ON
b.new_portalId=u.new_portalId
AND
b.statecode=0
AND
b.statuscode=1 --Active
WHERE
u.new_name='{0}'
AND
u.statecode=0";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, url));
if (dt != null && dt.Rows.Count > 0)
{
returnValue.CrmId = (Guid)dt.Rows[0]["BrandId"];
returnValue.Success = true;
}
else
{
returnValue.Result = "M004"; //"Girmiş olduğunuz adres herhangi bir portala ait değil.";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:42,代码来源:PortalHelper.cs
示例13: GetPageContent
public static MsCrmResult GetPageContent(Guid portalId, PageNames pageName, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
pc.new_content AS Content
FROM
new_pagecontent AS pc (NOLOCK)
WHERE
pc.new_portalId='{0}'
AND
pc.new_page={1}
AND
pc.statecode=0";
#endregion
DataTable dt = sda.getDataTable(string.Format(sqlQuery, portalId, ((int)pageName).ToString()));
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["Content"] != DBNull.Value)
{
returnValue.Success = true;
returnValue.Result = dt.Rows[0]["Content"].ToString();
}
}
else
{
returnValue.Result = "M051"; //"Sayfa içeriği hazırlanmamıştır.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:41,代码来源:PageContentHelper.cs
示例14: LoginControl
public static MsCrmResult LoginControl(Guid portalId, string userName, string password, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string query = @"SELECT
U.new_userId UserId
FROM
new_user U (NoLock)
WHERE
U.new_name = '{0}'
AND
U.new_password = '{1}'
AND
U.statecode = 0
AND
U.statuscode = {2}";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, userName, password, (int)PortalUserStatus.Active));
if (dt != null && dt.Rows.Count > 0)
{
returnValue.CrmId = (Guid)dt.Rows[0]["UserId"];
MsCrmResultObject roleResult = PortalUserHelper.GetPortalUserRoles(portalId, returnValue.CrmId, sda);
returnValue.Success = roleResult.Success;
returnValue.Result = roleResult.Result;
}
else
{
returnValue.Success = false;
returnValue.Result = "M035"; //"Hatalı kullanıcı adı veya şifre!";
}
}
catch (Exception ex)
{
throw ex;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:41,代码来源:LoginHelper.cs
示例15: GetUserLoginCount
public static int GetUserLoginCount(Guid portalId, Guid portalUserId, DateTime start, DateTime end, SqlDataAccess sda)
{
int returnValue = 0;
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
COUNT(0)
FROM
new_loginlog AS ll (NOLOCK)
WHERE
[email protected]
AND
[email protected]
AND
ll.new_logindate BETWEEN @start AND @end
AND
ll.StateCode=0";
#endregion
SqlParameter[] parameters = {
new SqlParameter("@PortalId",portalId)
,new SqlParameter("@UserId",portalUserId)
,new SqlParameter("@start",start)
,new SqlParameter("@end",end)
};
returnValue = (int)sda.ExecuteScalar(sqlQuery, parameters);
}
catch (Exception ex)
{
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:40,代码来源:LoginHelper.cs
示例16: GetCities
public static MsCrmResultObj<List<City>> GetCities(SqlDataAccess sda)
{
MsCrmResultObj<List<City>> returnValue = new MsCrmResultObj<List<City>>();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
c.new_cityId AS Id
,c.new_name AS Name
,c.new_citycode AS Code
FROM
new_city AS c (NOLOCK)
WHERE
c.new_countryId='F55A5B6D-B32E-E511-80C4-000D3A216510'";
#endregion
DataTable dt = sda.getDataTable(sqlQuery);
if (dt.Rows.Count > 0)
{
List<City> cityList = dt.ToList<City>();
returnValue.Success = true;
returnValue.ReturnObject = cityList;
}
else
{
returnValue.Result = "Kayıt bulunamadı.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:40,代码来源:LocationHelper.cs
示例17: Process
public void Process(SqlDataAccess sda)
{
FileLogHelper.LogFunction(this.GetType().Name,"SendSms_ServiceProcess_Process_TRIGGERED", LOG_PATH);
SqlParameter[] parameters = new SqlParameter[]{
new SqlParameter("@statusCode",(int)SmsStatusCode.WaitingSend)
};
try
{
DataTable dt = _sda.getDataTable(Constants.QUERY_GET_SMS_RECORDS_BY_STATUSCODE, parameters);
FileLogHelper.LogFunction(this.GetType().Name,"SendSms_ServiceProcess_Process_SmsRecordCount:" + dt.Rows.Count.ToString(), LOG_PATH);
foreach (DataRow row in dt.Rows)
{
SendSms((Guid)row["Id"], row["PhoneNumber"].ToString(), row["Message"].ToString());
}
}
catch (Exception ex)
{
FileLogHelper.LogFunction(this.GetType().Name,"SendSms_ServiceProcess_Process_EXCEPTION:" + ex.Message, ERROR_LOG_PATH);
}
}
开发者ID:volkanytu,项目名称:Portal,代码行数:24,代码来源:ServiceProcess.cs
示例18: SearchContact
public static MsCrmResultObject SearchContact(Guid portalId, Guid userId, string key, SqlDataAccess sda)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
try
{
#region | SQL QUERY |
string query = @"SELECT DISTINCT
u.new_userId AS UserId
,u.new_name AS UserName
,u.new_imageurl AS ImageUrl
,c.FullName
,c.JobTitle
,CASE WHEN fr.new_friendshipId IS NOT NULL THEN 1 ELSE 0 END AS IsFriend
FROM
new_user AS u (NOLOCK)
JOIN
new_new_user_new_role AS ur (NOLOCK)
ON
ur.new_userid=u.new_userId
JOIN
new_role AS r (NOLOCK)
ON
ur.new_roleid=r.new_roleId
AND
r.statecode=0
AND
r.statuscode=1 --Active
AND
r.new_portalId='{0}'
JOIN
Contact AS c (NOLOCK)
ON
u.new_contactId=c.ContactId
LEFT JOIN
new_friendship AS fr (NOLOCK)
ON
'{2}' IN (fr.new_partyOneId,fr.new_partyTwoId)
AND
u.new_userId IN (fr.new_partyOneId,fr.new_partyTwoId)
AND
fr.statecode=0
WHERE
u.statecode=0
AND
u.new_userId!='{2}'
AND
u.statuscode=1 --Active
AND
c.FullName LIKE '%{1}%'";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, portalId, key, userId));
if (dt != null && dt.Rows.Count > 0)
{
List<UserFriends> lstUser = new List<UserFriends>();
for (int i = 0; i < dt.Rows.Count; i++)
{
UserFriends uf = new UserFriends()
{
UserId = (Guid)dt.Rows[i]["UserId"],
UserName = dt.Rows[i]["UserName"].ToString(),
FullName = dt.Rows[i]["FullName"].ToString(),
ImageUrl = dt.Rows[i]["ImageUrl"] != DBNull.Value ? dt.Rows[i]["ImageUrl"].ToString() : "nouserprofile.jpg",
JobTitle = dt.Rows[i]["JobTitle"] != DBNull.Value ? dt.Rows[i]["JobTitle"].ToString() : "---",
UserType = (int)dt.Rows[i]["IsFriend"]
};
lstUser.Add(uf);
}
returnValue.Success = true;
returnValue.ReturnObject = lstUser;
}
else
{
returnValue.Success = false;
returnValue.Result = "M057"; //"Herhangi bir kayıt bulunamadı!";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message;
}
return returnValue;
}
开发者ID:volkanytu,项目名称:Portal,代码行数:91,代码来源:ContactHelper.cs
示例19: GetContactInfo
public static MsCrmResultObject GetContactInfo(Guid contactId, SqlDataAccess sda)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
try
{
#region | SQL QUERY |
string query = @"SELECT
C.ContactId
,C.FirstName
,C.LastName
,C.JobTitle
,C.new_functionname FunctionName
,C.AccountId
,C.AccountIdName
,C.EMailAddress1 EmailAddress
,C.MobilePhone
,C.Telephone1
,C.new_identitynumber AS IdentityNo
,C.GenderCode
,DATEADD(HH,3,C.BirthDate) AS BirthDate
,C.Description
,C.new_cityId AS CityId
,C.new_cityIdName AS CityIdName
,C.new_townId AS TownId
,C.new_townIdName AS TownIdName
,C.new_addressdetail AS AddressDetail
,C.new_markcontact AS MarkContact
FROM
Contact C (NoLock)
WHERE
C.ContactId = '{0}'
AND
C.StateCode = 0";
#endregion
DataTable dt = sda.getDataTable(string.Format(query, contactId));
if (dt != null && dt.Rows.Count > 0)
{
Contact _contact = new Contact();
_contact.ContactId = (Guid)dt.Rows[0]["ContactId"];
_contact.FirstName = dt.Rows[0]["FirstName"] != DBNull.Value ? dt.Rows[0]["FirstName"].ToString() : string.Empty;
_contact.LastName = dt.Rows[0]["LastName"] != DBNull.Value ? dt.Rows[0]["LastName"].ToString() : string.Empty;
_contact.Title = dt.Rows[0]["JobTitle"] != DBNull.Value ? dt.Rows[0]["JobTitle"].ToString() : string.Empty;
_contact.FunctionName = dt.Rows[0]["FunctionName"] != DBNull.Value ? dt.Rows[0]["FunctionName"].ToString() : string.Empty;
_contact.EmailAddress = dt.Rows[0]["EmailAddress"] != DBNull.Value ? dt.Rows[0]["EmailAddress"].ToString() : string.Empty;
_contact.MobilePhone = dt.Rows[0]["MobilePhone"] != DBNull.Value ? dt.Rows[0]["MobilePhone"].ToString() : string.Empty;
_contact.WorkPhone = dt.Rows[0]["Telephone1"] != DBNull.Value ? dt.Rows[0]["Telephone1"].ToString() : string.Empty;
_contact.IdentityNumber = dt.Rows[0]["IdentityNo"] != DBNull.Value ? dt.Rows[0]["IdentityNo"].ToString() : string.Empty;
if (dt.Rows[0]["GenderCode"] != DBNull.Value) { _contact.Gender = (int)dt.Rows[0]["GenderCode"]; }
if (dt.Rows[0]["BirthDate"] != DBNull.Value) { _contact.BirthDate = (DateTime)dt.Rows[0]["BirthDate"]; }
_contact.Description = dt.Rows[0]["Description"] != DBNull.Value ? dt.Rows[0]["Description"].ToString() : string.Empty;
_contact.MarkContact = dt.Rows[0]["MarkContact"] != DBNull.Value ? (bool)dt.Rows[0]["MarkContact"] : false;
if (dt.Rows[0]["AccountId"] != DBNull.Value)
{
EntityReference er = new EntityReference();
er.LogicalName = "account";
er.Id = (Guid)dt.Rows[0]["AccountId"];
if (dt.Rows[0]["AccountIdName"] != DBNull.Value) { er.Name = dt.Rows[0]["AccountIdName"].ToString(); }
_contact.ParentAccount = er;
}
if (dt.Rows[0]["CityId"] != DBNull.Value)
{
EntityReference er = new EntityReference();
er.LogicalName = "new_city";
er.Id = (Guid)dt.Rows[0]["CityId"];
if (dt.Rows[0]["CityIdName"] != DBNull.Value) { er.Name = dt.Rows[0]["CityIdName"].ToString(); }
_contact.CityId = er;
}
if (dt.Rows[0]["TownId"] != DBNull.Value)
{
EntityReference er = new EntityReference();
er.LogicalName = "new_town";
er.Id = (Guid)dt.Rows[0]["TownId"];
if (dt.Rows[0]["TownIdName"] != DBNull.Value) { er.Name = dt.Rows[0]["TownIdName"].ToString(); }
_contact.TownId = er;
}
if (dt.Rows[0]["AccountId"] != DBNull.Value)
{
EntityReference er = new EntityReference();
er.LogicalName = "account";
er.Id = (Guid)dt.Rows[0]["AccountId"];
if (dt.Rows[0]["AccountIdName"] != DBNull.Value) { er.Name = dt.Rows[0]["AccountIdName"].ToString(); }
_contact.ParentAccount = er;
}
_contact.AddressDetail = dt.Rows[0]["AddressDetail"] != DBNull.Value ? dt.Rows[0]["AddressDetail"].ToString() : string.Empty;
returnValue.ReturnObject = _contact;
returnValue.Success = true;
}
else
{
//.........这里部分代码省略.........
开发者ID:volkanytu,项目名称:Portal,
|
请发表评论