本文整理汇总了C#中GK.Library.Utility.SqlDataAccess.openConnection方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataAccess.openConnection方法的具体用法?C# SqlDataAccess.openConnection怎么用?C# SqlDataAccess.openConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GK.Library.Utility.SqlDataAccess
的用法示例。
在下文中一共展示了SqlDataAccess.openConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: 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;
}
示例3: GetUserRecentContacts
public string GetUserRecentContacts(string token)
{
List<MessageInfo> userRecentMessages = null;
LoginSession loginSession = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token))
{
MsCrmResultObject userSession = this.GetUserSession(token);
if (userSession.Success)
{
loginSession = (LoginSession)userSession.ReturnObject;
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
userRecentMessages = MessageHelper.GetUserRecentContacts(loginSession.PortalId, loginSession.PortalUserId, sda);
}
}
}
finally
{
if (this.sda != null)
{
this.sda.closeConnection();
}
}
JavaScriptSerializer ser = new JavaScriptSerializer();
string json = ser.Serialize(userRecentMessages);
return json;
}
示例4: 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;
}
示例5: Execute
public void Execute(IServiceProvider serviceProvider)
{
SqlDataAccess sda = null;
try
{
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
#region | SERVICE |
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
#region | Validate Request |
//Target yoksa veya Entity tipinde değilse, devam etme.
if (!context.InputParameters.Contains("Target") || !(context.InputParameters["Target"] is Entity))
{
return;
}
#endregion
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
#endregion
Entity entity = (Entity)context.InputParameters["Target"];
#region |DEFINE IMAGE IF EXISTS|
Entity postImage = null;
if (context.PostEntityImages.Contains("PostImage") && context.PostEntityImages["PostImage"] is Entity)
{
postImage = (Entity)context.PostEntityImages["PostImage"];
}
#endregion
#region | VARIABLES |
List<ScoreLimit> lstLimits = new List<ScoreLimit>();
EntityReference portal = null;
EntityReference user = null;
if (postImage.Contains("new_portalid") && postImage["new_portalid"] != null)
{
portal = (EntityReference)postImage["new_portalid"];
}
if (postImage.Contains("new_userid") && postImage["new_userid"] != null)
{
user = (EntityReference)postImage["new_userid"];
}
#endregion
if (entity.Contains("statuscode") && entity["statuscode"] != null && ((OptionSetValue)entity["statuscode"]).Value == 1)
{
MsCrmResultObject limitRes = ScoreHelper.GetScoreLimitsByType(ScoreType.ForumSubject, sda);
if (limitRes.Success)
{
lstLimits = (List<ScoreLimit>)limitRes.ReturnObject;
for (int i = 0; i < lstLimits.Count; i++)
{
int recCount = 0;
DateTime start = GeneralHelper.GetStartDateByScorePeriod(lstLimits[i].Period);
DateTime end = GeneralHelper.GetEndDateByScorePeriod(lstLimits[i].Period);
recCount = ForumHelper.GetUserForumSubjectCount(portal.Id, user.Id, start, end, sda);
if (lstLimits[i].Frequency >= recCount)
{
Score sc = new Score()
{
Point = lstLimits[i].Point,
Portal = portal,
User = user,
ScoreType = ScoreType.ForumSubject
};
MsCrmResult scoreRes = ScoreHelper.CreateScore(sc, service);
break;
}
}
}
}
}
catch (Exception ex)
{
//LOG
throw new InvalidPluginExecutionException(ex.Message);
}
finally
{
if (sda != null)
sda.closeConnection();
}
}
示例6: ProcessRequest
public void ProcessRequest(HttpContext context)
{
FileLogHelper.LogEvent("Kale-uploadHelper", @"C:\DO\");
context.Response.ContentType = "application/json";
object returnValue = null;
JavaScriptSerializer serializer = new JavaScriptSerializer();
try
{
_sda = new SqlDataAccess();
_sda.openConnection(Globals.ConnectionString);
string operation = context.Request.QueryString["operation"];
string userId = context.Request.QueryString["userid"];
string graffitiId = context.Request.QueryString["graffitiId"];
if (operation == "1" && !string.IsNullOrEmpty(userId)) //Profile resmi güncelleme
{
returnValue = new MsCrmResult();
_service = MSCRM.GetOrgService(true);
HttpPostedFile file = context.Request.Files[0];
returnValue = SaveProfileImage(userId, file, context);
}
else if (operation == "2" && !string.IsNullOrEmpty(graffitiId)) //Duvar yazısı resim ekleme
{
returnValue = new MsCrmResult();
_service = MSCRM.GetOrgService(true);
HttpPostedFile file = context.Request.Files[0];
returnValue = SaveGraffitiImage(new Guid(graffitiId), file, context);
}
else
{
((MsCrmResultObject)returnValue).Result = "Eksik veya yanlış parametre.";
}
}
catch (Exception ex)
{
returnValue = new MsCrmResult();
((MsCrmResult)returnValue).HasException = true;
((MsCrmResult)returnValue).Result = ex.Message;
}
finally
{
if (_sda != null)
{
_sda.closeConnection();
}
}
var dataRes = serializer.Serialize(returnValue);
context.Response.Write(dataRes);
}
示例7: CheckIsUserYourFriend
public MsCrmResult CheckIsUserYourFriend(string token, string selectedUserId)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(selectedUserId))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
returnValue = FriendshipHelper.CheckIsUserYourFriend(ls.PortalId, ls.PortalUserId, new Guid(selectedUserId), sda);
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!-CheckIsUserYourFriend";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message + "-CheckIsUserYourFriend";
}
finally
{
if (sda != null)
{
sda.closeConnection();
}
}
return returnValue;
}
示例8: GetAnnotations
public List<Annotation> GetAnnotations(string objectId)
{
List<Annotation> returnList = new List<Annotation>();
try
{
if (!string.IsNullOrEmpty(objectId))
{
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
returnList = AnnotationHelper.GetAnnotationListByObject(new Guid(objectId), sda);
}
}
catch (Exception)
{
}
finally
{
if (sda != null)
{
sda.closeConnection();
}
}
return returnList;
}
示例9: CompleteRequest
public MsCrmResult CompleteRequest(string token, string requestId)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token) || !string.IsNullOrEmpty(requestId))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
IOrganizationService service = MSCRM.GetOrgService(true);
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
AssemblyRequestInfo req = new AssemblyRequestInfo()
{
Id = new Guid(requestId),
StatusCode = new OptionSetValueWrapper()
{
AttributeValue = (int)AssemblyRequestStatus.Completed
}
};
returnValue = AssemblyRequestHelper.UpdateAssemblyRequest(req, service);
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
finally
{
if (sda != null)
{
sda.closeConnection();
}
}
return returnValue;
}
示例10: SaveDiscoveryForm
public MsCrmResult SaveDiscoveryForm(string token, DiscoveryForm discForm)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
#region | VALIDATION |
if (string.IsNullOrEmpty(discForm.FirstName))
{
returnValue.Result = "Ad alanı boş olamaz";
return returnValue;
}
if (string.IsNullOrEmpty(discForm.LastName))
{
returnValue.Result = "Soyadı alanı boş olamaz";
return returnValue;
}
if (string.IsNullOrEmpty(discForm.PhoneNumber))
{
returnValue.Result = "Telefon Numarası alanı boş olamaz";
return returnValue;
}
if (string.IsNullOrEmpty(discForm.Email))
{
returnValue.Result = "Email alanı boş olamaz";
return returnValue;
}
if (discForm.CityId == null || discForm.CityId.Id == Guid.Empty)
{
returnValue.Result = "İl alanı boş olamaz";
return returnValue;
}
if (discForm.TownId == null || discForm.TownId.Id == Guid.Empty)
{
returnValue.Result = "İlçe alanı boş olamaz";
return returnValue;
}
//if (discForm.HomeType == null || discForm.HomeType.AttributeValue == null || discForm.HomeType.AttributeValue == 0)
//{
// returnValue.Result = "Konut Tipi alanı boş olamaz";
// return returnValue;
//}
//if (discForm.VisitDate == null)
//{
// returnValue.Result = "En Uygun Tarih alanı boş olamaz";
// return returnValue;
//}
//if (discForm.VisitHour == null || discForm.VisitHour.AttributeValue == null || discForm.VisitHour.AttributeValue == 0)
//{
// returnValue.Result = "En Uygun Saat alanı boş olamaz";
// return returnValue;
//}
//if (discForm.InformedBy == null || discForm.InformedBy.AttributeValue == null || discForm.InformedBy.AttributeValue == 0)
//{
// returnValue.Result = "Kale 7/24'ü nereden duydunuz? alanı boş olamaz";
// return returnValue;
//}
#endregion
IOrganizationService service = MSCRM.GetOrgService(true);
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
discForm.Name = discForm.UserId.Name + "|" + DateTime.Now.ToString("dd.MM.yyyy HH:mm");
returnValue = DiscoveryFormHelper.CreateDiscoveryForm(discForm, service);
}
else
{
//.........这里部分代码省略.........
示例11: SaveAnswer
public MsCrmResult SaveAnswer(string token, Answer answer)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
IOrganizationService service = MSCRM.GetOrgService(true);
if (!answer.IsRefreshOrBack && !answer.IsTimeOverlap && answer.Choice != null && answer.Choice.Id != Guid.Empty)
{
List<QuestionChoices> choices = (List<QuestionChoices>)QuestionHelper.GetQuestionChoices(answer.Question.Id, sda).ReturnObject;
var query = (from a in choices
where
a.IsCorrect == true
&&
a.Id == answer.Choice.Id
select a).ToList();
if (query.Count > 0)
{
answer.IsCorrect = true;
}
else
{
answer.IsCorrect = false;
}
}
returnValue = AnswerHelper.SaveOrUpdateAnswer(answer, service);
if (returnValue.Success)
{
if (!answer.IsRefreshOrBack && !answer.IsTimeOverlap && answer.Choice != null && answer.Choice.Id != Guid.Empty)
{
if (answer.IsCorrect)
{
returnValue.Result = "Cevabınız doğru " + (answer.IsTrust ? (2 * answer.Point).ToString() : answer.Point.ToString()) + " puan kazandınız!";
}
else
{
returnValue.Success = false;
returnValue.Result = "Cevabınız yanlış.<br /><strong>" + (answer.IsTrust ? answer.Point.ToString() + " puan kaybettiniz." : string.Empty) + "</strong>";
}
}
else
{
returnValue.Success = false;
returnValue.Result = (answer.IsTimeOverlap ? "<p>Zaman doldu!<br /><strong>" : "Sayfadan çıktınız!<br /><strong>") + (answer.IsTrust ? answer.Point.ToString() + " puan kaybettiniz." : string.Empty) + "</strong></p>";
}
}
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!-SaveAnswer";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message + "-SaveAnswer";
}
finally
{
if (sda != null)
sda.closeConnection();
}
return returnValue;
}
示例12: HasUserRequestWithYou
public string HasUserRequestWithYou(string token, string selectedUserId)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
LoginSession ls = new LoginSession();
JavaScriptSerializer ser = new JavaScriptSerializer();
string json = string.Empty;
try
{
if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(selectedUserId))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
json = ser.Serialize(sessionResult);
return json;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
returnValue = FriendshipHelper.HasUserRequestWithYou(ls.PortalId, ls.PortalUserId, new Guid(selectedUserId), sda);
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!-HasUserRequestWithYou";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message + "-HasUserRequestWithYou";
}
finally
{
if (sda != null)
{
sda.closeConnection();
}
}
json = ser.Serialize(returnValue);
return json;
}
示例13: HasUserQuestionLimit
public MsCrmResult HasUserQuestionLimit(string token)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
returnValue = QuestionHelper.HasUserQuestionLimit(ls.PortalUserId, ls.PortalId, sda);
if (!returnValue.Success)
{
returnValue.Result = "M034"; //"Limitiniz dolmuştur. <br /> İşlem limitleri hakkında bilgi almak için ilgili birim ile görüşünüz.";
}
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!-HasUserQuestionLimit";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message + "-HasUserQuestionLimit";
}
finally
{
if (sda != null)
sda.closeConnection();
}
return returnValue;
}
示例14: CloseFriendshipRequest
public MsCrmResult CloseFriendshipRequest(string token, string requestId, int statusCode)
{
MsCrmResult returnValue = new MsCrmResult();
LoginSession ls = new LoginSession();
try
{
if (!string.IsNullOrEmpty(token))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
returnValue.Result = sessionResult.Result;
return returnValue;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
IOrganizationService service = MSCRM.GetOrgService(true);
returnValue = FriendshipHelper.CloseFriendshipRequest(new Guid(requestId), (FriendshipRequestStatus)statusCode, service);
if (returnValue.Success)
{
FriendshipRequest req = new FriendshipRequest();
MsCrmResultObject reqResult = FriendshipHelper.GetFriendshipRequestInfo(new Guid(requestId), sda);
if (reqResult.Success && ((FriendshipRequestStatus)statusCode) == FriendshipRequestStatus.Accepted)
{
req = (FriendshipRequest)reqResult.ReturnObject;
Friendship fr = new Friendship();
fr.PartyOne = req.From;
fr.PartyTwo = req.To;
fr.Portal = req.Portal;
fr.FriendshipRequest = new EntityReference("new_friendshiprequest", req.Id);
returnValue = FriendshipHelper.CreateFriendship(fr, service);
}
}
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!-CloseFriendshipRequest";
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message;
}
finally
{
if (sda != null)
sda.closeConnection();
}
return returnValue;
}
示例15: GetVideoCategoryInfo
public string GetVideoCategoryInfo(string token, string categoryId)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
LoginSession ls = new LoginSession();
JavaScriptSerializer ser = new JavaScriptSerializer();
string json = string.Empty;
try
{
if (!string.IsNullOrEmpty(token))
{
#region | CHECK SESSION |
MsCrmResultObject sessionResult = GetUserSession(token);
if (!sessionResult.Success)
{
json = ser.Serialize(sessionResult);
return json;
}
else
{
ls = (LoginSession)sessionResult.ReturnObject;
}
#endregion
sda = new SqlDataAccess();
sda.openConnection(Globals.ConnectionString);
returnValue = VideoHelper.GetVideoCategoryInfo(new Guid(categoryId), sda);
}
else
{
returnValue.Success = false;
returnValue.Result = "M003"; //"Eksik parametre!
}
}
catch (Exception ex)
{
returnValue.Success = false;
returnValue.Result = ex.Message + "-GetVideoCategoryInfo";
}
finally
{
if (sda != null)
{
sda.closeConnection();
}
}
json = ser.Serialize(returnValue);
return json;
}