protected void Button1_Click(object sender, EventArgs e)
    {
        if (ddl.SelectedIndex >= 0)
        {
            localhost.Service serviceObj = new localhost.Service();
            localhost.Table tableObj = listOfTables[ddl.SelectedIndex];
            localhost.TenantTableInfo obj = serviceObj.ReadData((int)Session["orgID"],tableObj.ObjIDProperty);
            string[] arr = obj.FieldNamesProperty;
            List<string> array = new List<string>(arr);
            string[] values = obj.FieldValuesProperty;
            List<string> valuearr = new List<string>(values);
            int countRow = valuearr.Count / array.Count;
            int counter = 0;
            for (int i = 0; i < countRow; i++)
            {

                TableRow row = new TableRow();
                for (int j = 0; j < array.Count; j++)
                {
                    TableCell cell = new TableCell();
                    cell.Text = valuearr[counter++].ToString();
                    row.Cells.Add(cell);

                }
                Table1.Rows.Add(row);
            }
        }
    }
Пример #2
0
    public Boolean authenticateUserNamePassword(string username, string password)
    {
        string uname = null, pword = null;
        localhost.Service serviceObj = new localhost.Service();
        localhost.TenantTableInfo obj = serviceObj.ReadData(11, 32);
        string[] arr = obj.FieldNamesProperty;
        List<string> array = new List<string>(arr);
        string[] values = obj.FieldValuesProperty;
        List<string> valuearr = new List<string>(values);
        int countRow = valuearr.Count / array.Count;
        int counter = 0;
        for (int i = 0; i < countRow; i++)
        {
            for (int j = 0; j < array.Count; j++)
            {
                if (arr[j].ToString() == "password")
                {
                    pword = valuearr[counter].ToString();
                    if (username == uname && pword == password)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }

                }
                if (arr[j].ToString() == "username")
                {
                    uname = valuearr[counter].ToString();
                }
                counter++;
            }
        }
        return false;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        localhost.Service serviceObj = new localhost.Service();
            localhost.TenantTableInfo obj = serviceObj.ReadData(11, 31);
            string[] arr = obj.FieldNamesProperty;
            List<string> array = new List<string>(arr);
            string[] values = obj.FieldValuesProperty;
            List<string> valuearr = new List<string>(values);
            int countRow = valuearr.Count / array.Count;
            int counter = 0;

            TableRow row = new TableHeaderRow();
            var cell1 = new TableCell();
            row.TableSection = TableRowSection.TableHeader;
            cell1.Text = "Global ID";
            row.Cells.Add(cell1);
            WfTable.Rows.Add(row);

            row.TableSection = TableRowSection.TableHeader;
            cell1 = new TableCell();
            cell1.Text = "Workflow Name";
            row.Cells.Add(cell1);
            WfTable.Rows.Add(row);

            row.TableSection = TableRowSection.TableHeader;
            cell1 = new TableCell();
            cell1.Text = "Selection";
            row.Cells.Add(cell1);
            WfTable.Rows.Add(row);

            int addrow = 0;

            for (int i = 0; i < countRow; i++)
            {
                addrow = 0;
                row = new TableRow();
                RadioButton rbnew = new RadioButton();
                if (i == 0)
                {
                    rbnew.Checked = true;
                }
                for (int j = 0; j < array.Count; j++)
                {
                   TableCell cell = new TableCell();
                   if (arr[j].ToString() == "GUID")
                   {
                       cell.Text = valuearr[counter].ToString();
                       rbnew.ID = valuearr[counter].ToString();
                       rbnew.EnableViewState = true;
                       rbnew.CheckedChanged += new EventHandler(Changed);
                       rbnew.AutoPostBack = true;
                       rbnew.GroupName = "Check";
                       row.Cells.Add(cell);
                   }
                   if (arr[j].ToString() == "wfname")
                   {
                       cell.Text = valuearr[counter].ToString();
                       row.Cells.Add(cell);
                   }
                   if (arr[j].ToString() == "ownerid")
                   {
                       if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"]))
                       {
                           addrow = 1;
                       }
                   }
                   counter++;
                }

                if (addrow == 1)
                {
                    TableCell cellcheck = null;
                    row.Cells.Add(cellcheck = new TableCell());
                    ((IParserAccessor)cellcheck).AddParsedSubObject(rbnew);
                    WfTable.Rows.Add(row);
                }
            }
    }
Пример #4
0
    public int bill_to_card_displayConfirmation(int OrgID,int CustomerID,int ProductID,int Quantity,double price)
    {
        try
        {
            bool success = false;
            Order order_obj = new Order();
            int CustomerObjID = 0;
            int OrderObjID = 0;

            localhost.Service serviceObj = new localhost.Service();
            localhost.Table[] Tarray = serviceObj.GetTables(OrgID);
            List<localhost.Table> listOfTables = new List<localhost.Table>(Tarray);
            for (int i = 0; i < listOfTables.Count; i++)
            {
                if (listOfTables[i].TNameProperty == "Customer")
                {
                    CustomerObjID = listOfTables[i].ObjIDProperty;
                }
                if (listOfTables[i].TNameProperty == "Order")
                {
                    OrderObjID = listOfTables[i].ObjIDProperty;
                }
            }

            if (CustomerObjID != 0)
            {
                localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(OrgID, CustomerObjID, CustomerID);
                string[] arr = obj.FieldNamesProperty;
                List<string> array = new List<string>(arr);
                string[] values = obj.FieldValuesProperty;
                List<string> valuearr = new List<string>(values);
                int counter = 0;

                for (int j = 0; j < array.Count; j++)
                {
                    if (arr[j].ToString() == "Ship_FirstName")
                    {
                        order_obj.Ship_FirstName = valuearr[counter].ToString();
                    }
                    if (arr[j].ToString() == "Ship_LastName")
                    {
                        order_obj.Ship_LastName = valuearr[counter].ToString();
                    }
                    if (arr[j].ToString() == "Ship_phone")
                    {
                        order_obj.Ship_phone = valuearr[counter].ToString();
                    }
                    if (arr[j].ToString() == "Ship_postalcode")
                    {
                        order_obj.Ship_postalcode = valuearr[counter].ToString();
                    }
                    if (arr[j].ToString() == "Ship_AddressLine1")
                    {
                        order_obj.Ship_AddressLine1 = valuearr[counter].ToString();
                    }
                    if (arr[j].ToString() == "Ship_AddressLine2")
                    {
                        order_obj.Ship_AddressLine2 = valuearr[counter].ToString();
                    }
                    counter++;
                }

                order_obj.ProductID = ProductID;
                order_obj.Quantity = Quantity;
                order_obj.OrderStatus = "Billed";
                order_obj.OrderDate = DateTime.Now;
                order_obj.DateLastUpdated = DateTime.Now;

                List<String> fieldnames = new List<String>();
                fieldnames.Add("0");
                fieldnames.Add("1");
                fieldnames.Add("2");
                fieldnames.Add("3");
                fieldnames.Add("4");
                fieldnames.Add("5");
                fieldnames.Add("6");
                fieldnames.Add("7");
                fieldnames.Add("8");
                fieldnames.Add("9");
                fieldnames.Add("10");
                fieldnames.Add("11");
                fieldnames.Add("12");

                List<String> valueNames = new List<String>();
                valueNames.Add(order_obj.ProductID.ToString());
                valueNames.Add(order_obj.Quantity.ToString());
                valueNames.Add(order_obj.OrderDate.ToString());
                valueNames.Add(order_obj.DateLastUpdated.ToString());
                valueNames.Add(order_obj.OrderStatus.ToString());
                valueNames.Add(order_obj.Ship_FirstName.ToString());
                valueNames.Add(order_obj.Ship_LastName.ToString());
                valueNames.Add(order_obj.Ship_AddressLine1.ToString());
                valueNames.Add(order_obj.Ship_AddressLine2.ToString());
                valueNames.Add(order_obj.Ship_phone.ToString());
                valueNames.Add(order_obj.Ship_postalcode.ToString());
                valueNames.Add(order_obj.Price.ToString());
                valueNames.Add(CustomerID.ToString());

                int custorderID = 0;
                success = serviceObj.InsertData(OrgID, OrderObjID, "Order-Instance-" + OrgID.ToString(), fieldnames.ToArray(), valueNames.ToArray());
                if (success)
                {
                    obj = serviceObj.ReadData(OrgID, OrderObjID);
                    arr = obj.FieldNamesProperty;
                    array = new List<string>(arr);
                    values = obj.FieldValuesProperty;
                    valuearr = new List<string>(values);
                    int countRow = valuearr.Count / array.Count;
                    counter = 0;
                    for (int i = 0; i < countRow; i++)
                    {
                        for (int j = 0; j < array.Count; j++)
                        {
                            if (arr[j].ToString() == "GUID")
                            {
                                custorderID = Convert.ToInt32(valuearr[counter].ToString());
                            }
                            counter++;
                        }
                    }
                    return custorderID;
                }
                else
                {
                    return custorderID;
                }
            }
            else
            {
                return 0;
            }
        }
        catch (Exception ex)
        {
            throw;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        PreRender += new EventHandler(CustomizeWorkflow_PreRender);
        lstipTextBoxes = new List<TextBox>();
        lstMethodNames = new List<TextBox>();
        if (!Page.IsPostBack)
        {
            ShowServices();
        }

        string Methods;
        string Inputs;
        string[] MethodIDs = null;
        string[] Input = null;

        #region DataSourceBinding

        //Get methods for the workflow ID
        localhost.Service serviceObj = new localhost.Service();
        localhost.TenantTableInfo obj = serviceObj.ReadDataWithGUID(11, 31, Convert.ToInt32(Session["WfID"]));
        string[] arr = obj.FieldNamesProperty;
        List<string> array = new List<string>(arr);
        string[] values = obj.FieldValuesProperty;
        List<string> valuearr = new List<string>(values);
        int counter = 0;
        defaultwrkflw.WfID = Convert.ToInt32(Session["WfID"]);
        for (int j = 0; j < array.Count; j++)
        {
            if (arr[j].ToString() == "wfname")
            {
                defaultwrkflw.WfName = valuearr[counter].ToString();
            }
            if (arr[j].ToString() == "wfmethods")
            {
                Methods = valuearr[counter].ToString();
                MethodIDs = Methods.Split(',');
            }
            if (arr[j].ToString() == "wfinputs")
            {
                Inputs = valuearr[counter].ToString();
                Input = Inputs.Split(',');
                defaultwrkflw.Inputs = Input;
            }
            counter++;
        }

        foreach (var item in MethodIDs)
        {
            defaultwrkflw.Methods.Add(Convert.ToInt32(item));
            obj = serviceObj.ReadDataWithGUID(11, 30, Int32.Parse(item));
            arr = obj.FieldNamesProperty;
            array = new List<string>(arr);
            values = obj.FieldValuesProperty;
            valuearr = new List<string>(values);
            counter = 0;
            for (int j = 0; j < array.Count; j++)
            {
                if (arr[j].ToString() == "minput")
                {
                    defaultwrkflw.InputParam.Add(valuearr[counter].ToString());
                }
                if (arr[j].ToString() == "mname")
                {
                    defaultwrkflw.MethodName.Add(valuearr[counter].ToString());
                }
                if (arr[j].ToString() == "moutput")
                {
                    defaultwrkflw.OutputParam.Add(valuearr[counter].ToString());
                }
                counter++;
            }
        }

        obj = serviceObj.ReadData(11, 30);
        arr = obj.FieldNamesProperty;
        array = new List<string>(arr);
        values = obj.FieldValuesProperty;
        valuearr = new List<string>(values);
        int countRow = valuearr.Count / array.Count;
        counter = 0;
        int addrow = 0;
        for (int i = 0; i < countRow; i++)
        {
            AvailableServices serv = new AvailableServices();
            addrow = 0;
            for (int j = 0; j < array.Count; j++)
            {
                if (arr[j].ToString() == "GUID")
                {
                    serv.MethodId = Convert.ToInt32(valuearr[counter].ToString());
                }
                if (arr[j].ToString() == "mname")
                {
                    serv.MethodName = valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "minput")
                {
                    serv.InputParam = valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "moutput")
                {
                    serv.OutputParam = valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "ownerid")
                {
                    if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"]))
                    {
                        addrow = 1;
                    }
                }
                counter++;
            }
            if (addrow > 0)
            {
                availservice.Add(serv);
            }
        }
        #endregion

        #region AddControls
        int methodcounter = 0;
        Panel2.Controls.Add(new LiteralControl("<br />"));

        Label work_label = new Label();
        work_label.Text = defaultwrkflw.WfName + " Workflow Steps";
        work_label.Font.Bold = true;
        work_label.Font.Size = 20;
        Panel2.Controls.Add(work_label);
        Panel2.Controls.Add(new LiteralControl("<br />"));
        Table methodtable = new Table();
        methodtable.BorderStyle = BorderStyle.Solid;
        methodtable.BorderWidth = 5;
        methodtable.Font.Bold = true;
        methodtable.Font.Size = 10;
        methodtable.Attributes.Add("runat", "Server");
        methodtable.ID = defaultwrkflw.Methods[methodcounter].ToString();

        TableRow row = new TableHeaderRow();
        var cell1 = new TableCell();
        cell1.Text = "Service Name";
        row.Cells.Add(cell1);

        cell1 = new TableCell();
        cell1.Text = "Ouput Mapping";
        row.Cells.Add(cell1);
        methodtable.Rows.Add(row);

        counter = 0;
        foreach (string item in defaultwrkflw.MethodName)
        {
            if (!item.Equals(""))
            {
                TableRow tr = new TableRow();
                TableCell tc = new TableCell();
                TableCell tc2 = new TableCell();

                TextBox txtMethodName = new TextBox();
                txtMethodName.Width = 350;
                txtMethodName.Text = item;
                TextBox txtInputParam = new TextBox();
                txtInputParam.Text = defaultwrkflw.Inputs[counter++];
                txtInputParam.Width = 50;
                lstipTextBoxes.Add(txtInputParam);
                lstMethodNames.Add(txtMethodName);
                tc.Controls.Add(txtMethodName);
                tc2.Controls.Add(txtInputParam);

                methodtable.Controls.Add(tr);
                tr.Controls.Add(tc);
                tr.Controls.Add(tc2);
            }
        }
        int methodcount = 10 - defaultwrkflw.MethodName.Count;
        while (methodcount > 0 )
        {
            TableRow tr = new TableRow();
            TableCell tc = new TableCell();
            TableCell tc2 = new TableCell();

            TextBox txtMethodName = new TextBox();
            txtMethodName.Width = 350;
            txtMethodName.Text = "";

            TextBox txtInputParam = new TextBox();
            txtInputParam.Text = "";
            txtInputParam.Width = 50;
            lstipTextBoxes.Add(txtInputParam);
            lstMethodNames.Add(txtMethodName);
            tc.Controls.Add(txtMethodName);
            tc2.Controls.Add(txtInputParam);

            methodtable.Controls.Add(tr);
            tr.Controls.Add(tc);
            tr.Controls.Add(tc2);
            methodcount--;
        }
        Panel2.Controls.Add(methodtable);

        #endregion
    }
    void ShowServices()
    {
        localhost.Service serviceObj = new localhost.Service();
        localhost.TenantTableInfo obj = serviceObj.ReadData(11, 30);
        string[] arr = obj.FieldNamesProperty;
        List<string> array = new List<string>(arr);
        string[] values = obj.FieldValuesProperty;
        List<string> valuearr = new List<string>(values);
        int counter = 0;
        int addrow = 0;
        int countRow = valuearr.Count / array.Count;

        DataColumn col1 = new DataColumn("Service Name");
        DataColumn col2 = new DataColumn("Input params");
        DataColumn col3 = new DataColumn("Output params");
        col1.DataType = System.Type.GetType("System.String");
        col2.DataType = System.Type.GetType("System.String");
        col3.DataType = System.Type.GetType("System.String");
        dt.Columns.Add(col1);
        dt.Columns.Add(col2);
        dt.Columns.Add(col3);

        for (int i = 0; i < countRow; i++)
        {
            addrow = 0;
            DataRow row = dt.NewRow();
            for (int j = 0; j < array.Count; j++)
            {

                if (arr[j].ToString() == "mname")
                {
                    row[col1] = valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "minput")
                {
                    row[col2] =  valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "moutput")
                {
                    row[col3] =  valuearr[counter].ToString();
                }
                if (arr[j].ToString() == "ownerid")
                {
                    if (Convert.ToInt32(valuearr[counter]) == 11 || Convert.ToInt32(valuearr[counter]) == Convert.ToInt32(Session["OrgId"]))
                    {
                        addrow = 1;
                    }
                }
                counter++;
            }
            if (addrow > 0)
            {
                dt.Rows.Add(row);
            }
        }

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }