WorkflowLink
Namespace:
Omnia.Fx.SharePoint
We found 10 examples in language CSharp for this search.
You will see 28 fragments of code.
Other methods
Other methods
Project:mypowerscgl
File:Link.cs
Examples:1
/**//// <summary>
/// �ж������Ƿ����
/// </summary>
/// <returns></returns>
public bool LinkExist()
{
if (linkGuid.Trim().Length == 0 || linkGuid == null)
throw new Exception("LinkExist��������linkGuid ����Ϊ�գ�");
return WorkFlowLink.LinkExist(linkGuid);
}
Project:analytics
File:Link_Multiple_Tests.cs
Examples:3
[TestMethod]
public async Task Link_Multiple_LinkDataSourceMultipleStep()
{
Assert.IsTrue(File.Exists(SutDataSourceFile), $"{SutDataSourceFile} does not exist. Executing: {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}");
Assert.IsTrue(File.Exists(SutRuleFile), $"{SutRuleFile} does not exist. Executing: {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}");
try
{
// Load rules
Stream ruleStream = new MemoryStream(await FileFactoryService.GetInstance().ReadAllBytesAsync(SutRuleFile));
SutRules = excelService.GetWorkbook(ruleStream);
var matchingEntity = SutRules.ToMatchingRule();
// Load data source
Stream dataSourceStream = new MemoryStream(await FileFactoryService.GetInstance().ReadAllBytesAsync(SutDataSourceFile));
SutWorkbook = excelService.GetWorkbook(dataSourceStream, Path.GetFileName(SutRuleFile));
foreach (var sheet in SutWorkbook.Sheets)
{
var dataSourceRecords = new List<DataSourceEntity>();
foreach (var row in sheet.Rows)
dataSourceRecords.Add(new DataSourceEntity(row));
var workflowLink = new LinkDataSourceMultipleStep<DataSourceEntity>();
var linkResults = workflowLink.Execute(matchingEntity, dataSourceRecords);
Assert.IsTrue(linkResults.Any(), "No results from filter service.");
}
}
catch (Exception ex)
{
logItem.LogError(ex.Message, ex);
Assert.Fail(ex.Message);
}
}
[TestMethod]
public async Task Link_Multiple_PersistMatchResultStep()
{
Assert.IsTrue(File.Exists(SutDataSourceFile), $"{SutDataSourceFile} does not exist. Executing: {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}");
Assert.IsTrue(File.Exists(SutRuleFile), $"{SutRuleFile} does not exist. Executing: {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}");
try
{
// Load rules
Stream ruleStream = new MemoryStream(await FileFactoryService.GetInstance().ReadAllBytesAsync(SutRuleFile));
SutRules = excelService.GetWorkbook(ruleStream);
var matchingEntity = SutRules.ToMatchingRule();
// Load data source
Stream dataSourceStream = new MemoryStream(await FileFactoryService.GetInstance().ReadAllBytesAsync(SutDataSourceFile));
SutWorkbook = excelService.GetWorkbook(dataSourceStream, Path.GetFileName(SutRuleFile));
foreach (var sheet in SutWorkbook.Sheets)
{
var dataSourceRecords = sheet.ToDataSourceEntity();
var workflowLink = new LinkDataSourceMultipleStep<DataSourceEntity>();
var linkResults = workflowLink.Execute(matchingEntity, dataSourceRecords);
Assert.IsTrue(linkResults.Any(), "No results from filter service.");
var workflowPersist = new PersistMatchResultStep<DataSourceEntity>(configDestination);
var persistResults = await workflowPersist.ExecuteAsync(linkResults);
Assert.IsTrue(persistResults.Any(), "No results from filter service.");
}
}
catch (Exception ex)
{
logItem.LogError(ex.Message, ex);
Assert.Fail(ex.Message);
}
}
[TestCleanup]
public void Cleanup()
{
}
Project:Convenience
File:WorkFlowFlowService.cs
Examples:4
WorkFlowFlowResultModel GetWorkFlowFlow(int workflowId);
Task<bool> AddOrUpdateWorkFlowFlow(WorkFlowFlowViewModel viewModel);
public async Task<bool> AddOrUpdateWorkFlowFlow(WorkFlowFlowViewModel viewModel)
{
try
{
var userName = _httpContextAccessor.HttpContext?.User?.GetUserName();
foreach (var link in viewModel.WorkFlowLinkViewModels)
{
link.WorkFlowId = viewModel.WorkFlowId;
}
foreach (var node in viewModel.WorkFlowNodeViewModels)
{
node.WorkFlowId = viewModel.WorkFlowId;
}
foreach (var condition in viewModel.WorkFlowConditionViewModels)
{
condition.WorkFlowId = viewModel.WorkFlowId;
}
var workflow = await _workflowRepository.GetAsync(viewModel.WorkFlowId);
workflow.UpdatedTime = DateTime.Now;
workflow.UpdatedUser = userName;
await _linkRepository.RemoveAsync(f => f.WorkFlowId == viewModel.WorkFlowId);
await _linkRepository.AddAsync(_mapper.Map<IEnumerable<WorkFlowLink>>(viewModel.WorkFlowLinkViewModels));
await _nodeRepository.RemoveAsync(f => f.WorkFlowId == viewModel.WorkFlowId);
await _nodeRepository.AddAsync(_mapper.Map<IEnumerable<WorkFlowNode>>(viewModel.WorkFlowNodeViewModels));
await _conditionRepository.RemoveAsync(f => f.WorkFlowId == viewModel.WorkFlowId);
await _conditionRepository.AddAsync(_mapper.Map<IEnumerable<WorkFlowCondition>>(viewModel.WorkFlowConditionViewModels));
await _unitOfWork.SaveAsync();
return true;
}
catch (Exception e)
{
_logger.LogError(e.StackTrace);
return false;
}
}
public WorkFlowFlowResultModel GetWorkFlowFlow(int workflowId)
{
var links = _linkRepository.Get(f => f.WorkFlowId == workflowId).ToArray();
var nodes = _nodeRepository.Get(f => f.WorkFlowId == workflowId).ToArray();
var conditions = _conditionRepository.Get(f => f.WorkFlowId == workflowId).ToArray();
return new WorkFlowFlowResultModel
{
WorkFlowLinkResults = _mapper.Map<IEnumerable<WorkFlowLinkResultModel>>(links),
WorkFlowNodeResults = _mapper.Map<IEnumerable<WorkFlowNodeResultModel>>(nodes),
WorkFlowConditionResults = _mapper.Map<IEnumerable<WorkFlowConditionResultModel>>(conditions)
};
}
Project:spvisionet
File:BuktiSetorCT.aspx.cs
Examples:6
#endregion
#region Event Handlers
/// <summary>
/// Raises the init event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (Request.QueryString["List"] != null)
taskListId = new Guid(HttpUtility.UrlDecode(Request.QueryString["List"]));
if (Request.QueryString["ID"] != null)
{
try
{
taskItemId = Convert.ToInt32(Request.QueryString["ID"]);
}
catch (Exception)
{
taskItemId = 0;
}
}
if (Request.QueryString["Source"] != null)
{
source = HttpUtility.UrlDecode(Request.QueryString["Source"]);
}
}
/// <summary>
/// Raises the load event.
/// </summary>
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!this.IsPostBack)
LoadFormData();
}
/// <summary>
/// Handles the Click event of the btnSave control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void btnSave_Click(object sender, EventArgs e)
{
SPWeb web = SPControl.GetContextWeb(this.Context);
using (SPSite site = new SPSite(web.Url, web.Site.SystemAccount.UserToken))
{
using (SPWeb webSA = site.OpenWeb())
{
webSA.AllowUnsafeUpdates = true;
SPList taskList = webSA.Lists[taskListId];
SPListItem taskItem = taskList.GetItemById(taskItemId);
Hashtable taskData = new Hashtable();
taskData.Add("PercentComplete", 1);
taskData.Add("BuktiSetor", chkBuktiSetor.Checked);
taskData.Add("Completed", true);
taskData.Add("Status", "Completed");
SPWorkflowTask.AlterTask(taskItem, taskData, true);
if (taskItem["ParentID"] != null)
{
SPListItem taskItemParent = taskList.GetItemById(Convert.ToInt32(taskItem["ParentID"].ToString()));
SPWorkflowTask.AlterTask(taskItemParent, taskData, true);
}
webSA.AllowUnsafeUpdates = false;
}
}
if (source != string.Empty)
SPUtility.Redirect("Default.aspx", SPRedirectFlags.UseSource, this.Context);
else
Response.Redirect(web.Url, true);
}
/// <summary>
/// Handles the Click event of the btnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void btnCancel_Click(object sender, EventArgs e)
{
SPWeb web = SPControl.GetContextWeb(this.Context);
if (source != string.Empty)
SPUtility.Redirect("Default.aspx", SPRedirectFlags.UseSource, this.Context);
else
Response.Redirect(web.Url, true);
}
#endregion
#region Methods
/// <summary>
/// Loads the form data.
/// </summary>
private void LoadFormData()
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb web = SPControl.GetContextWeb(this.Context);
SPList taskList = web.Lists[taskListId];
SPListItem taskItem = taskList.GetItemById(taskItemId);
ltlTitle.Text = Convert.ToString(taskItem["Title"]);
if (taskItem["BuktiSetor"] != null)
chkBuktiSetor.Checked = Convert.ToBoolean(taskItem["BuktiSetor"]);
if (taskItem["WorkflowLink"].ToString().Contains("Lists/PerusahaanBaru"))
GeneratePendirianPerusahaanBaruIndonesiaLink(taskItem["WorkflowLink"].ToString());
else
{
string[] relatedItemLink = Convert.ToString(taskItem["WorkflowLink"]).Split(',');
linkRelatedItem.Target = "_blank";
linkRelatedItem.NavigateUrl = string.Format("{0}", relatedItemLink[0].Trim().Replace("DispForm", "EditForm"));
linkRelatedItem.Text = relatedItemLink[1].Trim();
}
});
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
#region Pendirian Perusahaan Baru (Indonesia)
private void GeneratePendirianPerusahaanBaruIndonesiaLink(string wfLink)
{
string[] relatedItemLink = wfLink.Split(',');
linkRelatedItem.Target = "_blank";
string link = string.Format("{0}", relatedItemLink[0].Trim().Replace("DispForm", "EditForm"));
Uri tempUri = new Uri(link);
string sQuery = tempUri.Query;
ViewState["ID"] = HttpUtility.ParseQueryString(sQuery).Get("ID");
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb web = SPControl.GetContextWeb(this.Context);
SPList list = web.GetList(Util.CreateSharePointListStrUrl(web.Url, "PerusahaanBaru"));
SPListItem item = list.GetItemById(Convert.ToInt32(ViewState["ID"]));
if (item["Status"].ToString() == Common.Roles.PIC_CORSEC + "_2")
linkRelatedItem.NavigateUrl = string.Format("{0}", relatedItemLink[0].Trim());
else
linkRelatedItem.NavigateUrl = string.Format("{0}", relatedItemLink[0].Trim().Replace("DispForm", "EditForm"));
});
linkRelatedItem.Text = relatedItemLink[1].Trim();
}
Project:spvisionet
File:Delegate.aspx.cs
Examples:4
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (Request.QueryString["ListID"] != null)
taskListId = new Guid(HttpUtility.UrlDecode(Request.QueryString["ListID"]));
if (Request.QueryString["IDP"] != null)
{
try
{
taskItemId = Convert.ToInt32(Request.QueryString["IDP"]);
}
catch (Exception)
{
taskItemId = 0;
}
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!this.IsPostBack)
LoadFormData();
}
private void LoadFormData()
{
try
{
SPWeb web = SPControl.GetContextWeb(this.Context);
SPList taskList = web.Lists[taskListId];
SPListItem taskItem = taskList.GetItemById(taskItemId);
ltlTitle.Text = Convert.ToString(taskItem["Title"]);
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
protected void btnDelegate_Click(object sender, EventArgs e)
{
if (pe.CommaSeparatedAccounts == string.Empty)
{
lblErrorMsg.Visible = true;
return;
}
try
{
SPWeb web = SPControl.GetContextWeb(this.Context);
using (SPSite site = new SPSite(web.Url, web.Site.SystemAccount.UserToken))
{
using (SPWeb webSA = site.OpenWeb())
{
webSA.AllowUnsafeUpdates = true;
SPList taskList = webSA.Lists[taskListId];
SPListItem taskItem = taskList.GetItemById(taskItemId);
SPListItem targetItem = taskList.Items.Add();
foreach (SPField f in taskItem.Fields)
{
if (!f.ReadOnlyField && f.InternalName != "Attachments")
{
targetItem[f.InternalName] = taskItem[f.InternalName];
}
}
targetItem["WorkflowLink"] = taskItem["WorkflowLink"];
targetItem["WorkflowInstanceID"] = taskItem["WorkflowInstanceID"];
targetItem["ParentID"] = taskItem.ID;
SPUser newUser = null;
string newAssignedTo = string.Empty;
try
{
newUser = webSA.SiteUsers[pe.CommaSeparatedAccounts];
newAssignedTo = newUser.ID.ToString();
}
catch
{
lbl.Text = "Delegate user is not valid.";
return;
}
targetItem["AssignedTo"] = newAssignedTo;
targetItem.Update();
if (!targetItem.HasUniqueRoleAssignments)
targetItem.BreakRoleInheritance(false);
targetItem.Web.AllowUnsafeUpdates = true;
SPRoleDefinition ContributeRoleDefinition = targetItem.Web.RoleDefinitions["Contribute"];
SPRoleAssignment RoleAssignment = new SPRoleAssignment(newUser.LoginName, string.Empty, string.Empty, string.Empty);
RoleAssignment.RoleDefinitionBindings.Add(ContributeRoleDefinition);
targetItem.RoleAssignments.Add(RoleAssignment);
//targetItem.Update();
webSA.AllowUnsafeUpdates = false;
lbl.Text = "Successfully delegate task to user " + newUser.LoginName.ToLower();
pe.Enabled = false;
btnDelegate.Enabled = false;
}
}
}
catch
{
lbl.Text = "Error. Please try again.";
}
}
Project:ca
File:Tasks.ascx.cs
Examples:3
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.Expires = 5;
//Response.ExpiresAbsolute = DateTime.Now;
Response.AddHeader("pragma", "no-cache");
Response.AddHeader("cache-control", "private");
Response.CacheControl = "no-cache";
this.Repeater1.DataSource = GetUserTasks();
this.Repeater1.DataBind();
//this.Repeater2.DataSource = GetRootTasks();
//this.Repeater2.DataBind();
}
DataTable GetUserTasks()
{
SPWeb web = SPContext.Current.Site.RootWeb;
SPSiteDataQuery query = new SPSiteDataQuery();
string swhere = @"<Where><And>
<Eq>
<FieldRef Name=""AssignedTo"" LookupId=""TRUE""/>
<Value Type=""Integer"">{0}</Value>
</Eq>
<Neq>
<FieldRef Name=""Status"" />
<Value Type=""Text"">{1}</Value>
</Neq>
</And></Where>";
string scompleted = SPUtility.GetLocalizedString("$Resources:core,Tasks_Completed;", "core", web.Language);
swhere = String.Format(swhere, web.CurrentUser.ID, scompleted);
string sorderby = "<OrderBy><FieldRef ID=\"" + SPBuiltInFieldId.Created_x0020_Date.ToString("B") + "\" Ascending=\"FALSE\" /></OrderBy>";
query.Query = swhere + sorderby;
query.Lists = "<Lists ServerTemplate=\"107\"/>";
query.ViewFields = "<FieldRef ID=\"" + SPBuiltInFieldId.Title.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.TaskDueDate.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.UniqueId.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.Completed.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.PercentComplete.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.TaskStatus.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.WorkflowLink.ToString("B") + "\" Nullable=\"TRUE\" Type=\"URL\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.FileRef.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.ID.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.Created_x0020_Date.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.FSObjType.ToString("B") + "\"/>";
query.Webs = "<Webs Scope=\"Recursive\" />";
string createdDateFieldId = SPBuiltInFieldId.Created_x0020_Date.ToString("B");
string uIdField = SPBuiltInFieldId.UniqueId.ToString("B");
string listField = SPBuiltInFieldId.FileRef.ToString("B");
query.RowLimit = 5;
DataTable t = web.GetSiteData(query);
string[] sep = new string[] { ";#" };
t.Columns.Add("WorkFlowUrl");
foreach (DataRow row in t.Rows)
{
string createdDate = "" + row[createdDateFieldId];
string[] tempArr = createdDate.Split(sep, StringSplitOptions.None);
if (tempArr.Length > 1)
row[createdDateFieldId] = Convert.ToDateTime(tempArr[1]).ToString("yyyy-MM-dd");
row[uIdField] = row[uIdField].ToString().Split(sep, StringSplitOptions.None)[1];
//35;#WorkFlowCenter/Lists/Tasks/35_.000
string workflowUrl = row[listField].ToString().Split(sep, StringSplitOptions.None)[1];
int index = workflowUrl.LastIndexOf(@"/");
workflowUrl = SPContext.Current.Site.RootWeb.Url + "/" + workflowUrl.Remove(index) + "/DispForm.aspx?ID=" + row[SPBuiltInFieldId.ID.ToString("B")];
row["WorkFlowUrl"] = workflowUrl + "&Source=" + this.Page.Request.RawUrl;
}
return t;
}
DataTable GetRootTasks()
{
SPWeb web = SPContext.Current.Site.RootWeb;
SPSiteDataQuery query = new SPSiteDataQuery();
string swhere = @"<Where><And>
<Eq>
<FieldRef Name=""AssignedTo"" LookupId=""TRUE""/>
<Value Type=""Integer"">{0}</Value>
</Eq>
<Neq>
<FieldRef Name=""Status"" />
<Value Type=""Text"">{1}</Value>
</Neq>
</And></Where>";
string scompleted = SPUtility.GetLocalizedString("$Resources:core,Tasks_Completed;", "core", web.Language);
swhere = String.Format(swhere, web.CurrentUser.ID, scompleted);
string sorderby = "<OrderBy><FieldRef ID=\"" + SPBuiltInFieldId.Created_x0020_Date.ToString("B") + "\"/></OrderBy>";
query.Query = swhere + sorderby;
query.Lists = "<Lists ServerTemplate=\"107\"/>";
query.ViewFields = "<FieldRef ID=\"" + SPBuiltInFieldId.Title.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.TaskDueDate.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.UniqueId.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.Completed.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.PercentComplete.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.TaskStatus.ToString("B") + "\" Nullable=\"TRUE\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.WorkflowLink.ToString("B") + "\" Nullable=\"TRUE\" Type=\"URL\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.FileRef.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.ID.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.Created_x0020_Date.ToString("B") + "\"/>";
query.ViewFields = query.ViewFields + "<FieldRef ID=\"" + SPBuiltInFieldId.FSObjType.ToString("B") + "\"/>";
query.Webs = "<Webs Scope=\"Recursive\" />";
string createdDateFieldId = SPBuiltInFieldId.Created_x0020_Date.ToString("B");
string uIdField = SPBuiltInFieldId.UniqueId.ToString("B");
string listField = SPBuiltInFieldId.FileRef.ToString("B");
query.RowLimit = 5;
DataTable t = web.GetSiteData(query);
if (t != null && t.Rows.Count > 0)
{
t.DefaultView.Sort = createdDateFieldId + " Desc";
}
string[] sep = new string[] { ";#" };
t.Columns.Add("WorkFlowUrl");
foreach (DataRow row in t.Rows)
{
string createdDate = "" + row[createdDateFieldId];
string[] tempArr = createdDate.Split(sep, StringSplitOptions.None);
if (tempArr.Length > 1)
row[createdDateFieldId] = Convert.ToDateTime(tempArr[1]).ToString("yyyy-MM-dd");
row[uIdField] = row[uIdField].ToString().Split(sep, StringSplitOptions.None)[1];
//35;#WorkFlowCenter/Lists/Tasks/35_.000
string workflowUrl = row[listField].ToString().Split(sep, StringSplitOptions.None)[1];
int index = workflowUrl.LastIndexOf(@"/");
workflowUrl = SPContext.Current.Site.RootWeb.Url + "/DispForm.aspx?ID=" + row[SPBuiltInFieldId.ID.ToString("B")];
row["WorkFlowUrl"] = workflowUrl + "&Source=" + this.Page.Request.RawUrl;
}
return t;
}
Project:Convenience
File:AutoMapperProfile.cs
Examples:1
using AutoMapper;
using Convience.Entity.Entity;
using Convience.Entity.Entity.Identity;
using Convience.Entity.Entity.Logs;
using Convience.Entity.Entity.WorkFlows;
using Convience.Model.Models.ContentManage;
using Convience.Model.Models.GroupManage;
using Convience.Model.Models.SystemManage;
using Convience.Model.Models.SystemTool;
using Convience.Model.Models.WorkFlowManage;
namespace Convience.Model
{
public class AutoMapperProfile : Profile
{
public AutoMapperProfile()
{
CreateMap<RoleViewModel, SystemRole>();
CreateMap<SystemRole, RoleResultModel>();
CreateMap<UserViewModel, SystemUser>();
CreateMap<SystemUser, UserResultModel>().ForMember(user => user.Sex,
ex => ex.MapFrom(result => (int)result.Sex));
CreateMap<MenuViewModel, Menu>();
CreateMap<Menu, MenuResultModel>().ForMember(menu => menu.Type,
ex => ex.MapFrom(result => (int)result.Type));
CreateMap<DepartmentViewModel, Department>();
CreateMap<Department, DepartmentResultModel>();
CreateMap<PositionViewModel, Position>();
CreateMap<Position, PositionResultModel>();
CreateMap<ColumnViewModel, Column>();
CreateMap<Column, ColumnResultModel>();
CreateMap<ArticleViewModel, Article>();
CreateMap<Article, ArticleResultModel>();
CreateMap<DicTypeViewModel, DicType>();
CreateMap<DicType, DicTypeResultModel>();
CreateMap<DicDataViewModel, DicData>();
CreateMap<DicData, DicDataResultModel>();
CreateMap<WorkFlowGroupViewModel, WorkFlowGroup>();
CreateMap<WorkFlowGroup, WorkFlowGroupResultModel>();
CreateMap<WorkFlowViewModel, WorkFlow>();
CreateMap<WorkFlow, WorkFlowResultModel>();
CreateMap<FormViewModel, WorkFlowForm>();
CreateMap<WorkFlowForm, FormResultModel>();
CreateMap<FormControlViewModel, WorkFlowFormControl>();
CreateMap<WorkFlowFormControl, FormControlResultModel>();
CreateMap<WorkFlowLinkViewModel, WorkFlowLink>();
CreateMap<WorkFlowLink, WorkFlowLinkResultModel>();
CreateMap<WorkFlowNodeViewModel, WorkFlowNode>();
CreateMap<WorkFlowNode, WorkFlowNodeResultModel>();
CreateMap<WorkFlowConditionViewModel, WorkFlowCondition>();
CreateMap<WorkFlowCondition, WorkFlowConditionResultModel>();
CreateMap<WorkFlowInstance, WorkFlowInstanceResultModel>();
CreateMap<WorkFlowInstanceValueViewModel, WorkFlowInstanceValue>();
CreateMap<WorkFlowInstanceValue, WorkFlowInstanceValueResultModel>();
CreateMap<WorkFlowInstanceRoute, WorkflowinstanceRouteResultModel>();
CreateMap<OperateLogDetailResultModel, OperateLogDetail>().ReverseMap();
CreateMap<OperateLogSettingResultModel, OperateLogSetting>().ReverseMap();
}
}
}
Project:ICBMS
File:WorkflowDashboardService.cs
Examples:2
public List<WorkflowDashboardDTO> GetDashboard()
{
// list all active workflows
List<WorkflowDashboardDTO> Dashboard = new List<WorkflowDashboardDTO>();
ApplicationService applicationService = new ApplicationService();
//get all applications with an instanceid in workflowlink field
List<application> apps = new List<application>();
apps = applicationService.GetAll().Where(a => string.IsNullOrEmpty(a.workflow_link) != true).ToList();
// get the store connection and set up store
string _wfStore = System.Configuration.ConfigurationManager.ConnectionStrings["iCBMSWF"].ToString();
SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(_wfStore);
//loop through the instance ids, retrieve from store add details to the WorkflowDashBoardDTO list
foreach (application a in apps)
{
WorkflowDashboardDTO wdto = new WorkflowDashboardDTO();
List<InstanceReader> instance = GetInstanceRow(a.workflow_link);
wdto.WorkflowInstanceId = a.id.ToString();//instance[0].Instance_id.ToString();
wdto.WorkflowName = instance[0].IdentityName.ToString();
wdto.Start = instance[0].CreationTime.Date.ToShortDateString();
wdto.User = "Admin"; //should be supplied from Auth-Web users who are admin
wdto.Role = "Workflow Adminstration"; // the role pertaining to workflow adminstration
wdto.Status = instance[0].ExecutionStatus;
Dashboard.Add(wdto);
}
return Dashboard;
}
public List<InstanceReader> GetInstanceRow(string id)
{
List<InstanceReader> results = new List<InstanceReader>();
InstanceReader add;
using (SqlConnection localCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["iCBMSWF"].ToString()))
{
string localCmd =
"Select * from [System.Activities.DurableInstancing].[Instances] where [InstanceId] = '" + id + "'";
SqlCommand cmd = localCon.CreateCommand();
cmd.CommandText = localCmd;
localCon.Open();
using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
add = new InstanceReader
{
CreationTime = DateTime.Parse(reader["CreationTime"].ToString()),
ExecutionStatus = reader["ExecutionStatus"].ToString(),
IdentityName = reader["IdentityName"].ToString(),
Instance_id = reader["InstanceId"].ToString()
};
results.Add(add);
}
}
}
return results;
}
Project:tvmcorptvs
File:TaskCorePage.cs
Examples:3
#endregion
#region Handlers
protected void Cancel_Click(object sender, EventArgs e)
{
if (IsDialog)
ClosePopup();
else
SPUtility.Redirect(CurrentTaskList.DefaultViewUrl, SPRedirectFlags.Default, this.Context);
}
#endregion
#region Execute Code
protected void Back()
{
if (IsDialog)
ClosePopup();
else
if (string.IsNullOrEmpty(SourceUrl))
SPUtility.Redirect(Request.RawUrl, SPRedirectFlags.Default, this.Context);
else
SPUtility.Redirect(SPEncode.UrlDecodeAsUrl(SourceUrl), SPRedirectFlags.Default, this.Context);
}
private void ClosePopup()
{
Context.Response.Clear();
Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>");
Context.Response.Flush();
Context.Response.End();
}
Project:Convenience
File:WorkFlowLink.cs
Examples:1
using Convience.Entity.Data;
using Convience.EntityFrameWork.Infrastructure;
namespace Convience.Entity.Entity.WorkFlows
{
[Entity(DbContextType = typeof(SystemIdentityDbContext))]
public class WorkFlowLink
{
public int Id { get; set; }
public string SourceId { get; set; }
public string TargetId { get; set; }
public string Connection { get; set; }
#region
public int WorkFlowId { get; set; }
public WorkFlow WorkFlow { get; set; }
#endregion
}
}