本文整理汇总了C#中Common.GetCurrentUserName方法的典型用法代码示例。如果您正苦于以下问题:C# Common.GetCurrentUserName方法的具体用法?C# Common.GetCurrentUserName怎么用?C# Common.GetCurrentUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common.GetCurrentUserName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{ // Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "alert('MyButton clicked!');", true);
string UserName = string.Empty;
Int32 RoleId;
try
{
Common objCommon = new Common();
UserName = objCommon.GetCurrentUserName();
//UserName = System.Web.HttpContext.Current.User.Identity.Name.Substring(11);
if (UserName == null || UserName == string.Empty)
{ Response.Redirect("~/Error.aspx"); }
if (Session["RoleId"] == null)
{
RoleId = GetRoleId(UserName);
Session["RoleId"] = RoleId;
}
else
{
RoleId = Convert.ToInt32(Session["RoleId"]);
}
switch (RoleId)
{
case 1: //superadmin
break;
case 2: //DC Admin
lirolemanagement.Visible = false;
break;
case 3: //Manager
lirolemanagement.Visible = false;
break;
case 4: //Associate
lirolemanagement.Visible = false;
liVendorManagement.Visible = false;
break;
case 5: //Report Viewer
lirolemanagement.Visible = false;
liadmin.Visible = false;
break;
case 6: //Report Viewer
lirolemanagement.Visible = false;
liadmin.Visible = false;
break;
default:
Response.Redirect("~/Error.aspx");
break;
}
}
catch (Exception ex)
{
throw;
}
}
}
示例2: AddNewDropPoint
public static int AddNewDropPoint(Model.RouteMaster ObjRouteMaster)
{
int rVal = 0;
try
{
Common objCommon = new Common();
RouteMasterBLL ObjBllRouteMaster = new RouteMasterBLL();
ObjRouteMaster.CreatedBy = objCommon.GetCurrentUserName();
rVal = ObjBllRouteMaster.InsertDropPoint(ObjRouteMaster);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
return rVal;
}
示例3: AddNewRoute
public static bool AddNewRoute(Model.RouteMaster ObjRouteMaster)
{
bool isFlag = false;
try
{
Common objCommon = new Common();
RouteMasterBLL ObjBllRouteMaster = new RouteMasterBLL();
ObjRouteMaster.CreatedBy = objCommon.GetCurrentUserName();
Int32 rVal = ObjBllRouteMaster.InsertRouteMaster(ObjRouteMaster);
if (rVal > 0)
{
return (isFlag = true);
}
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
return isFlag;
}
示例4: UpdateRequest
public static bool UpdateRequest(OnDemandRequest Request)
{
bool isFlag = false;
OnDemandRequestBLL objMyRequestBLL = null;
try
{
Common objCommon = new Common();
objMyRequestBLL = new OnDemandRequestBLL();
Request.ModifiedBy = objCommon.GetCurrentUserName();
isFlag = objMyRequestBLL.UpdateRequest(Request);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objMyRequestBLL = null;
}
return isFlag;
}
示例5: DeleteSelectedVendor
public static bool DeleteSelectedVendor(string vendorIds,string Comment,bool IsActive)
{
bool isFlag = false;
VendorManagementBLL objVendorManagementBLL = null;
try
{
Common objCommon = new Common();
objVendorManagementBLL = new VendorManagementBLL();
string ModifiedBy =objCommon.GetCurrentUserName();
isFlag = objVendorManagementBLL.Active_InactiveVendor(vendorIds, IsActive, Comment, ModifiedBy);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objVendorManagementBLL = null;
}
return isFlag;
}
示例6: AddNewVendor
public static Int32 AddNewVendor(Vendor vendor)
{
int isFlag = 0;
Common objCommon = new Common();
VendorManagementBLL objVendorManagementBLL = null;
try
{
objVendorManagementBLL = new VendorManagementBLL();
vendor.CreatedBy = objCommon.GetCurrentUserName();
isFlag=objVendorManagementBLL.InsertVendor(vendor);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objVendorManagementBLL = null;
}
return isFlag;
}
示例7: AddNewCabProperty
public static Int32 AddNewCabProperty(CabProperty CabProperty)
{
int isFlag = 0;
Common objCommon = new Common();
PropertyManagementBLL objCabPropertyManagementBLL = null;
try
{
objCabPropertyManagementBLL = new PropertyManagementBLL();
CabProperty.CreatedBy = objCommon.GetCurrentUserName();
isFlag = objCabPropertyManagementBLL.InsertCabProperty(CabProperty);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objCabPropertyManagementBLL = null;
}
return isFlag;
}
示例8: GetRejectedUserList
public static List<OnDemandRequest> GetRejectedUserList()
{
List<OnDemandRequest> lstUsersDetail = null;
OnDemandRequestBLL objUserDetail = null;
try
{
objUserDetail = new OnDemandRequestBLL();
Common objCommon = new Common();
lstUsersDetail = objUserDetail.GetRejectedUserDetails(objCommon.GetCurrentUserName());
}
catch (Exception ex)
{
Common.WriteError(ex);
}
finally
{
objUserDetail = null;
}
return lstUsersDetail;
}
示例9: ApproveUserRequest
public static bool ApproveUserRequest(string UserId, string Comment)
{
bool isFlag = false;
OnDemandRequestBLL objDriverDetailBLL = null;
try
{
Common objCommon = new Common();
objDriverDetailBLL = new OnDemandRequestBLL();
string ModifiedBy = objCommon.GetCurrentUserName();
isFlag = objDriverDetailBLL.ApproveUserRequest(UserId, ModifiedBy, Comment);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objDriverDetailBLL = null;
}
return isFlag;
}
示例10: DeleteSelectedDriver
public static bool DeleteSelectedDriver(string DriverId, string Comment, bool IsActive)
{
bool isFlag = false;
DriverDetailsBLL objDriverDetailBLL = null;
try
{
Common objCommon = new Common();
objDriverDetailBLL = new DriverDetailsBLL();
string ModifiedBy = objCommon.GetCurrentUserName();
isFlag = objDriverDetailBLL.ActiveInactiveDriver(DriverId, IsActive, ModifiedBy);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objDriverDetailBLL = null;
}
return isFlag;
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
Int32 RoleId;
string UserName = string.Empty;
if (Session["RoleId"] == null)
{
Common objCommon = new Common();
UserName = objCommon.GetCurrentUserName();
using (RoleManagementBLL objRoleManagementBLL = new RoleManagementBLL())
{
RoleId = objRoleManagementBLL.GetRoleId(UserName);
Session["RoleId"] = RoleId;
}
}
else
{
RoleId = Convert.ToInt32(Session["RoleId"]);
}
switch (RoleId)
{
case 1:
break;
case 2:
break;
case 3:
break;
default:
Response.Redirect("~/Error.aspx");
break;
}
}
}
catch(Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
}
示例12: UpdateCabDetail
public static bool UpdateCabDetail(CabManagementt cabManagement)
{
bool isFlag = false;
CabManagementBLL objCabManagementBLL = null;
try
{
Common objCommon = new Common();
objCabManagementBLL = new CabManagementBLL();
cabManagement.ModifiedBy = objCommon.GetCurrentUserName();
isFlag = objCabManagementBLL.UpdateCabDetail(cabManagement);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objCabManagementBLL = null;
}
return isFlag;
}
示例13: InsertCabDetail
public static Int32 InsertCabDetail(CabManagementt cabManagement)
{
CabManagementBLL objCabManagementBLL = null;
Int32 Result=0;
try
{
Common objCommon = new Common();
objCabManagementBLL = new CabManagementBLL();
cabManagement.CreatedBy = objCommon.GetCurrentUserName();
Result = objCabManagementBLL.InsertCabDetail(cabManagement);
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
finally
{
objCabManagementBLL = null;
}
return Result;
}
示例14: UpdateDropPoint
public static Int32 UpdateDropPoint(Model.RouteMaster ObjRouteMaster)
{
Int32 isFlag = 0;
try
{
Common objCommon = new Common();
RouteMasterBLL ObjBllRouteMaster = new RouteMasterBLL();
ObjRouteMaster.CreatedBy = objCommon.GetCurrentUserName();
Int32 rVal = ObjBllRouteMaster.UpdateRouteMaster(ObjRouteMaster);
isFlag = rVal;
}
catch (Exception ex)
{
// Log the error to a text file in the Error folder
Common.WriteError(ex);
}
return isFlag;
}
示例15: UpdateDriver
public static Int32 UpdateDriver(DriverDetail DriverDetail)
{
DriverDetailsBLL objDriverDetailBLL = null;
Int32 outResult = 0;
try
{
objDriverDetailBLL = new DriverDetailsBLL();
Common objCommon = new Common();
DriverDetail.ModifyBy = objCommon.GetCurrentUserName();
//DriverDetail.IsActive = true;
outResult = objDriverDetailBLL.UpdateDriverDetail(DriverDetail);
}
catch (Exception ex)
{
Common.WriteError(ex);
}
finally
{
objDriverDetailBLL = null;
}
return outResult;
}