本文整理汇总了C#中BrightPlatformEntities.FIUpdateUserLock方法的典型用法代码示例。如果您正苦于以下问题:C# BrightPlatformEntities.FIUpdateUserLock方法的具体用法?C# BrightPlatformEntities.FIUpdateUserLock怎么用?C# BrightPlatformEntities.FIUpdateUserLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightPlatformEntities
的用法示例。
在下文中一共展示了BrightPlatformEntities.FIUpdateUserLock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MovePrevious
private void MovePrevious(ManageCampaignBookingEvents.OnLoadPreviousCompany.CampaignList e)
{
m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = false;
if (gvCampaignList.RowCount < 1)
return;
/**
* check current company if being released by the the user before loading the next company.
*/
sub_campaign_account_lists _item = null;
int _AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "account_id").ToString());
int _FinalListId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "final_list_id").ToString());
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
_item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i =>
i.account_id == _AcctId &&
i.final_list_id == _FinalListId
);
if (_item != null)
_efDbContext.Detach(_item);
if ((_item.locked && _item.locked_by == UserSession.CurrentUser.UserId) || !_item.locked) {
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", false);
this.GetCurrentCampaignListAccount();
this.ReleaseCurrentCompanyLock();
}
/**
* [@jeff 10.18.2013]: https://brightvision.jira.com/browse/PLATFORM-2638
* added logic to go to the next company if campaign list is on companies and contacts mode.
*/
int _Row = 0;
if (gvCampaignList.FocusedRowHandle > 0)
_Row = gvCampaignList.FocusedRowHandle - 1;
for (; _Row < gvCampaignList.RowCount; _Row--) {
int _PrevAcctId = ValidationUtility.TryParseInt(ValidationUtility.IFNullString(gvCampaignList.GetRowCellValue(_Row, "account_id"),"0"));
if (_AcctId != _PrevAcctId)
break;
}
/**
* now, we will load the next company and re-check if this is currently worked by other consultants.
*/
m_BrightSalesProperty.CommonProperty.CompanyLocked = false;
gvCampaignList.FocusedRowHandle = _Row;
_AcctId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "account_id").ToString());
_FinalListId = ValidationUtility.TryParseInt(gvCampaignList.GetRowCellValue(m_CampaignListSelectedRow, "final_list_id").ToString());
_item = _efDbContext.sub_campaign_account_lists.FirstOrDefault(i =>
i.account_id == _AcctId &&
i.final_list_id == _FinalListId
);
if (_item.locked && _item.locked_by > 0 && _item.locked_by != UserSession.CurrentUser.UserId) {
user _user = _efDbContext.users.FirstOrDefault(i => i.id == _item.locked_by);
if (_user != null)
_efDbContext.Detach(_user);
m_BrightSalesProperty.CommonProperty.CompanyLocked = true;
NotificationDialog.Warning("Bright Sales", string.Format("{0}This company is currently worked by{0}{1}", Environment.NewLine, _user.fullname));
}
this.SetCampaignListAppointmentParams();
if (!m_BrightSalesProperty.CommonProperty.CompanyLocked) {
bool islocked = m_CurrentCampaignListAccount.locked;
int? lockedBy = m_CurrentCampaignListAccount.locked_by;
bool _State = islocked && lockedBy != UserSession.CurrentUser.UserId ? false : true;
btnWorkOnCompany.Enabled = _State;
btnRemoveCompany.Enabled = _State;
if ((islocked && lockedBy == UserSession.CurrentUser.UserId) || !islocked) {
//var BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
m_CurrentCampaignListAccount.locked = true;
m_CurrentCampaignListAccount.locked_by = UserSession.CurrentUser.UserId;
m_CurrentCampaignListAccount.locked_timestamp = _efDbContext.FIUpdateUserLock(
m_FinalListId,
m_AccountId,
m_CurrentCampaignListAccount.locked,
m_CurrentCampaignListAccount.locked_by
).FirstOrDefault();
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", m_CurrentCampaignListAccount.locked);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by", m_CurrentCampaignListAccount.locked_by);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Locked_By_User", UserSession.CurrentUser.UserFullName);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_timestamp", m_CurrentCampaignListAccount.locked_timestamp);
}
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", true);
}
}
m_CampaignListSelectedRow = gvCampaignList.FocusedRowHandle < 0 ? 0 : gvCampaignList.FocusedRowHandle;
m_BrightSalesProperty.CampaignBooking.LoadPreviousCompanySuccess = true;
return;
}
示例2: GetFindFilterString
//.........这里部分代码省略.........
}
catch {
string _Val = m_OperatorArgs.Value.ToString();
if (_Val.Contains("=") ||
_Val.Contains(">") ||
_Val.Contains(">=") ||
_Val.Contains("<") ||
_Val.Contains("<=") ||
_Val.Contains("<>") ||
_Val.Contains("Between") ||
_Val.Contains("Is Null") ||
_Val.Contains("Is Not Null")) {
string _operand_value = ((DevExpress.Data.Filtering.BinaryOperator)(m_OperatorArgs.Value)).RightOperand.ToString();
if (!ValidationUtility.IsCurrency(_operand_value.Replace("'", ""))) {
string _temp = _Val.Replace("'", """);
_Val = _temp.Replace("[", "Lower(").Replace("]", ")");
}
else
m_CampaignListSpecificColumnFilter = _Val;
}
else {
DevExpress.Data.Filtering.CriteriaOperatorCollection _operators = ((DevExpress.Data.Filtering.FunctionOperator)(((DevExpress.Data.Filtering.CriteriaOperator)(m_OperatorArgs.Value)))).Operands;
string _operand_value = _operators[1].ToString();
if (!ValidationUtility.IsCurrency(_operand_value.Replace("'", ""))) {
string _temp = _Val.Replace("'", """);
_Val = _temp.Replace("[", "Lower(").Replace("]", ")");
}
m_CampaignListSpecificColumnFilter = _Val; //.Replace("[", "Lower(").Replace("]", ")");
}
m_CampaignListSpecificColumnFilter = _Val.Replace("'", "").Replace(""", "'");
}
//if (string.IsNullOrEmpty(gvCampaignList.FilterPanelText)) {
// m_CampaignListSpecificColumnFilter = string.Empty;
// return;
//}
//string[] _ColumnFilter = Regex.Split(gvCampaignList.FilterPanelText, " And ");
//for (int i = 0; i < _ColumnFilter.Count(); i++) {
// if (_ColumnFilter[i].Contains(">") ||
// _ColumnFilter[i].Contains(">=") ||
// _ColumnFilter[i].Contains("<") ||
// _ColumnFilter[i].Contains("<=") ||
// _ColumnFilter[i].Contains("Between") ||
// _ColumnFilter[i].Contains("Is Null") ||
// _ColumnFilter[i].Contains("Is Not Null") ||
// _ColumnFilter[i].Contains("In"))
// continue;
//}
//m_CampaignListSpecificColumnFilter = string.Join(" A ", _ColumnFilter.ToArray());
//if (!string.IsNullOrEmpty(m_CampaignListSpecificColumnFilter))
// m_CampaignListSpecificColumnFilter = m_CampaignListSpecificColumnFilter.Replace("[", "Lower(").Replace("]", ")");
}
/**/
private void WorkOnSelectedAccount()
{
if (gvCampaignList.RowCount < 1)
return;
try {
this.ReleaseCurrentCompanyLock();
bool islocked = m_CurrentCampaignListAccount.locked;
int? lockedBy = m_CurrentCampaignListAccount.locked_by;
bool _State = islocked && lockedBy != UserSession.CurrentUser.UserId ? false : true;
btnWorkOnCompany.Enabled = _State;
btnRemoveCompany.Enabled = _State;
if ((islocked && lockedBy == UserSession.CurrentUser.UserId) || !islocked) {
using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
m_CurrentCampaignListAccount.locked = true;
m_CurrentCampaignListAccount.locked_by = UserSession.CurrentUser.UserId;
m_CurrentCampaignListAccount.locked_timestamp =_efDbContext.FIUpdateUserLock(
m_FinalListId,
m_AccountId,
m_CurrentCampaignListAccount.locked,
m_CurrentCampaignListAccount.locked_by
).FirstOrDefault();
}
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", m_CurrentCampaignListAccount.locked);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by", m_CurrentCampaignListAccount.locked_by);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "Locked_By_User", UserSession.CurrentUser.UserFullName);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_timestamp", m_CurrentCampaignListAccount.locked_timestamp);
this.LoadCampaignBooking(ObjectEventSender.btnWorkOnCompany_Click);
}
else {
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", true);
NotificationDialog.Warning("Bright Sales", "The selected company is currently edited by another user. Please try again later.");
m_CurrentCampaignListAccount = null;
}
}
catch (Exception e) {
m_EventBus.Notify(new FrmSalesConsultantEvents.Tracer() {
ErrorMessage = e.Message
});
}
}
示例3: CanWorkCompany
public bool CanWorkCompany()
{
if (gvCampaignList.RowCount < 1)
return false;
this.GetCurrentCampaignListAccount();
this.ReleaseCurrentCompanyLock();
//this.GetCurrentCampaignListAccount();
if (m_CurrentCampaignListAccount == null)
return false;
bool islocked = m_CurrentCampaignListAccount.locked;
int? lockedBy = m_CurrentCampaignListAccount.locked_by;
if ((islocked && lockedBy == UserSession.CurrentUser.UserId) || !islocked)
{
var BPContext = new BrightPlatformEntities(UserSession.EntityConnection);
m_CurrentCampaignListAccount.locked = true;
m_CurrentCampaignListAccount.locked_by = UserSession.CurrentUser.UserId;
m_CurrentCampaignListAccount.locked_timestamp =
BPContext.FIUpdateUserLock(
m_CurrentCampaignListAccount.final_list_id,
m_CurrentCampaignListAccount.account_id,
m_CurrentCampaignListAccount.locked,
m_CurrentCampaignListAccount.locked_by).FirstOrDefault();
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked", m_CurrentCampaignListAccount.locked);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_by", m_CurrentCampaignListAccount.locked_by);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_user", UserSession.CurrentUser.UserFullName);
gvCampaignList.SetRowCellValue(gvCampaignList.FocusedRowHandle, "locked_timestamp", m_CurrentCampaignListAccount.locked_timestamp);
return true;
}
else
{
NotificationDialog.Warning("Bright Sales", "The selected company is currently edited by another user. Please try again later.");
m_CurrentCampaignListAccount = null;
return false;
}
}