Inheritance: MonoBehaviour
        public void RenderWithNoAttributes()
        {
            // Setup
            DropDownList c = new DropDownList();
            c.Name = "nameKey";

            ViewDataContainer vdc = new ViewDataContainer();
            vdc.Controls.Add(c);
            vdc.ViewData = new ViewDataDictionary();
            vdc.ViewData["nameKey"] = new SelectList(new[] { "aaa", "bbb", "ccc" }, "bbb");

            // Execute
            string html = MvcTestHelper.GetControlRendering(c, false);

            // Verify
            Assert.Equal(@"<select name=""nameKey"">
	<option>
		aaa
	</option><option selected=""selected"">
		bbb
	</option><option>
		ccc
	</option>
</select>", html);
        }
        public void RenderWithTextsAndValues()
        {
            // Setup
            DropDownList c = new DropDownList();
            c.Name = "nameKey";

            ViewDataContainer vdc = new ViewDataContainer();
            vdc.Controls.Add(c);
            vdc.ViewData = new ViewDataDictionary();
            vdc.ViewData["nameKey"] = new SelectList(
                new[]
                {
                    new { Text = "aaa", Value = "111" },
                    new { Text = "bbb", Value = "222" },
                    new { Text = "ccc", Value = "333" }
                },
                "Value",
                "Text",
                "222");

            // Execute
            string html = MvcTestHelper.GetControlRendering(c, false);

            // Verify
            Assert.Equal(@"<select name=""nameKey"">
	<option value=""111"">
		aaa
	</option><option value=""222"" selected=""selected"">
		bbb
	</option><option value=""333"">
		ccc
	</option>
</select>", html);
        }
Ejemplo n.º 3
0
 public void populateDropdownList(DropDownList dl, List<ClsKV> List)
 {
     dl.Items.Clear();
     for (int i = 0, n = List.Count; i < n; ++i) {
         dl.Items.Add(new ListItem(List[i].Value, List[i].Key));
     }
 }
Ejemplo n.º 4
0
 public static void AddTourType(DropDownList ddlTourType, int nLanguageID)
 {
     switch (nLanguageID)
     {
         case 1:
             ListItem all_v = new ListItem("--- Tất cả ---", "0", true);
             all_v.Selected = true;
             ddlTourType.Items.Add(all_v);
             ListItem active_v = new ListItem("Trong nước", "1", true);
             ddlTourType.Items.Add(active_v);
             ListItem inactive_v = new ListItem("Ngoài nước", "2", true);
             ddlTourType.Items.Add(inactive_v);
             break;
         case 2:
             ListItem all_e = new ListItem("--- All ---", "0", true);
             all_e.Selected = true;
             ddlTourType.Items.Add(all_e);
             ListItem active_e = new ListItem("Indigenous Tour", "1", true);
             ddlTourType.Items.Add(active_e);
             ListItem inactive_e = new ListItem("Foreign Tour", "2", true);
             ddlTourType.Items.Add(inactive_e);
             break;
         case 3:
             ListItem all_j = new ListItem("--- All ---", "0", true);
             all_j.Selected = true;
             ddlTourType.Items.Add(all_j);
             ListItem active_j = new ListItem("Indigenous Tour", "1", true);
             ddlTourType.Items.Add(active_j);
             ListItem inactive_j = new ListItem("Foreign Tour", "2", true);
             ddlTourType.Items.Add(inactive_j);
             break;
     }
 }
 protected void ddlBillingAdrs_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     //For Billing Adrs DDL
     DropDownList billingAddressDropDownList = new DropDownList();
     billingAddressDropDownList = (DropDownList)dvCompany.FindControl("ddlBillingAdrs");
     if (billingAddressDropDownList != null)
     {
         if (billingAddressDropDownList.SelectedValue == "1")
         {
             //Find existing Address Info
             (dvCompany.FindControl("txtBillingAddress") as TextBox).Text = (dvCompany.FindControl("txtAddress") as TextBox).Text;
             (dvCompany.FindControl("txtBillingCity") as TextBox).Text = (dvCompany.FindControl("txtCity") as TextBox).Text;
             (dvCompany.FindControl("txtBillingState") as TextBox).Text = (dvCompany.FindControl("txtState") as TextBox).Text;
             (dvCompany.FindControl("txtBillingZip") as TextBox).Text = (dvCompany.FindControl("txtZip") as TextBox).Text;
             (dvCompany.FindControl("txtBillingCountry") as TextBox).Text = (dvCompany.FindControl("txtCountry") as TextBox).Text;
             //Also make them readonly true
             (dvCompany.FindControl("txtBillingAddress") as TextBox).Enabled = false;
             (dvCompany.FindControl("txtBillingCity") as TextBox).Enabled = false;
             (dvCompany.FindControl("txtBillingState") as TextBox).Enabled = false;
             (dvCompany.FindControl("txtBillingZip") as TextBox).Enabled = false;
             (dvCompany.FindControl("txtBillingCountry") as TextBox).Enabled = false;
         }
         else
         {
             //Also make them readonly false
             (dvCompany.FindControl("txtBillingAddress") as TextBox).Enabled = true;
             (dvCompany.FindControl("txtBillingCity") as TextBox).Enabled = true;
             (dvCompany.FindControl("txtBillingState") as TextBox).Enabled = true;
             (dvCompany.FindControl("txtBillingZip") as TextBox).Enabled = true;
             (dvCompany.FindControl("txtBillingCountry") as TextBox).Enabled = true;
         }
     }
 }
Ejemplo n.º 6
0
    /// <summary>
    /// Binds the leader list to the current user's calendar access list.
    /// Inserts the user calendar for the selected user if it does not exist. This case would occur if 
    /// the current user does not have access to the selected user's calendar.  
    /// </summary>
    /// <param name="list">The list of user calendars.</param>
    /// <param name="selectedUserId">The selected user id.</param>
    public static void BindLeaderList(DropDownList list, string selectedUserId)
    {
        if (list.Items.Count > 1) return; // already loaded
        list.Items.Clear();
        bool selectedUserInList = false;
        List<UserCalendar> userCalendar = UserCalendar.GetCurrentUserCalendarList();
        foreach (UserCalendar uc in userCalendar)
        {
            if (uc.AllowAdd.HasValue && uc.AllowAdd.Value) // == true
            {
                if (uc.UserId.ToUpper().Trim() == selectedUserId.ToUpper().Trim()) selectedUserInList = true;
                ListItem listItem = new ListItem(uc.UserName, uc.CalUser.Id.ToString());
                list.Items.Add(listItem);
            }
        }
        UserCalendar suc = UserCalendar.GetUserCalendarById(selectedUserId);
        if (suc != null)
        {
            //Verify that we have the exact right userid.  i.e. 'ADMIN    ' may be trimmed to 'ADMIN'
            selectedUserId = suc.CalUser.Id.ToString();
            if (!selectedUserInList)
            {
                ListItem newItem = new ListItem(suc.UserName, suc.CalUser.Id.ToString());
                list.Items.Add(newItem);
            }
        }

        ListItem selected = list.Items.FindByValue(selectedUserId);
        if (selected == null)
        {
            selected = new ListItem(selectedUserId, selectedUserId);
            list.Items.Add(selected);
        }
        list.SelectedIndex = list.Items.IndexOf(selected);
    }
 /// <summary>
 /// Metodo para llenar un DropdownList
 /// </summary>
 /// <param name="dropDownList"></param>
 /// <param name="data"></param>
 public void Bind(DropDownList dropDownList, IList data, string value, string text)
 {
     dropDownList.DataSource = data;
     dropDownList.DataValueField = value;
     dropDownList.DataTextField = text;
     dropDownList.DataBind();
 }
Ejemplo n.º 8
0
        public LocationSelectorWithOptions(
            Page page,
            bool empty,
            DropDownList country,
            DropDownList state,
            DropDownList city,
            DropDownList neighborhood,
            DropDownList type,
            CheckBox picturesonly)
            :
            base(page, empty, country, state, city, neighborhood)
        {
            mType = type;
            mPicturesOnly = picturesonly;

            if (!mPage.IsPostBack)
            {
                List<TransitPlaceType> types = new List<TransitPlaceType>();
                if (InsertEmptySelection) types.Add(new TransitPlaceType());
                types.AddRange(page.SessionManager.GetCollection<TransitPlaceType>(
                    (ServiceQueryOptions)null, page.SessionManager.PlaceService.GetPlaceTypes));
                mType.DataSource = types;
                mType.DataBind();
            }
        }
Ejemplo n.º 9
0
 public static void SeleccionarItemCombo(ref DropDownList combo, string valor, string texto)
 {
     combo.ClearSelection();
     if ((combo.Items.FindByValue(valor) == null))
         combo.Items.Insert(0, new ListItem(texto, valor));
     combo.Items.FindByValue(valor).Selected = true;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// bind DropDownList control
 /// </summary>
 /// <param name="ddl">DropDownList control need to be bound</param>
 /// <param name="ds">data source</param>
 /// <param name="flag">bind style. true for binding text and value; false for binding text only.</param>
 public void bindDropDownList(DropDownList ddl, DataSet ds, bool flag)
 {
     if (ds.Tables[0].Rows.Count > 0)
     {
         DataTable dt = ds.Tables[0];
         int count = dt.Rows.Count;
         int index = 0;
         while (index < count)
         {
             if (flag)
             {
                 var li = new ListItem(dt.Rows[index][0].ToString().Trim(), dt.Rows[index][1].ToString().Trim());
                 ddl.Items.Add(li);
             }
             else
                 ddl.Items.Add(dt.Rows[index][0].ToString().Trim());
             index++;
         }
         ddl.Enabled = true;
     }
     else
     {
         if (flag)
         {
             var li = new ListItem("Not Exist", "-1");
             ddl.Items.Add(li);
         }
         else
             ddl.Items.Add("Not Exist");
         ddl.Enabled = false;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Fills chart type drop down 
 /// </summary>
 /// <param name="drp">Data drop down list</param>
 public void FillChartType(DropDownList drp)
 {
     drp.Items.Add(new ListItem(GetString("rep.graph.barchart"), "bar"));
     drp.Items.Add(new ListItem(GetString("rep.graph.barstackedchart"), "barstacked"));
     drp.Items.Add(new ListItem(GetString("rep.graph.piechart"), "pie"));
     drp.Items.Add(new ListItem(GetString("rep.graph.linechart"), "line"));
 }
Ejemplo n.º 12
0
 protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     DropDownList ddlevelForMultCh = (DropDownList)(GridView2.Rows[e.RowIndex].FindControl("ddlevelForMultCh"));
     caseOfErr = (DropDownList)(GridView2.Rows[e.RowIndex].FindControl("ddForMultChoCaseOferror"));
     e.NewValues.Add("caseOfError", caseOfErr.SelectedItem.ToString());
     e.NewValues.Add("level", ddlevelForMultCh.SelectedItem.ToString());
 }
Ejemplo n.º 13
0
    public static void FillCustomersDDL(string companyName, DropDownList ddl)
    {
        SqlDataReader sqlReader;

        SqlConnection sqlConn = new SqlConnection(sConnection);
        sqlConn.Open();

        using (SqlCommand sqlComm = new SqlCommand())
        {
            sqlComm.Connection = sqlConn;
            sqlComm.CommandType = CommandType.StoredProcedure;
            sqlComm.CommandText = "GetCustomers";

            SqlParameter sqlParam = new SqlParameter("@filter", SqlDbType.VarChar, 25);

            if (companyName != null || companyName != "")
                sqlParam.Value = companyName;
            else
                sqlParam.Value = "";

            sqlParam.Direction = ParameterDirection.Input;

            sqlComm.Parameters.Add(sqlParam);

            sqlReader = sqlComm.ExecuteReader(CommandBehavior.CloseConnection);
        }

        ddl.DataSource = sqlReader;
        ddl.DataTextField = "Company Name";
        ddl.DataValueField = "Customer ID";

        ddl.Items.Clear();
        ddl.DataBind();
        ddl.Items.Insert(0, new ListItem(String.Format("Select a Customer from [{0}]", ddl.Items.Count), "-1"));
    }
Ejemplo n.º 14
0
 public static void AddStaticData(DropDownList ddlStatus, int nLanguageID)
 {
     switch (nLanguageID)
     {
         case 1:
             ListItem all_v = new ListItem("--- Tất cả ---", "-1", true);
             all_v.Selected = true;
             ddlStatus.Items.Add(all_v);
             ListItem active_v = new ListItem("Hoạt động", "1", true);
             ddlStatus.Items.Add(active_v);
             ListItem inactive_v = new ListItem("Không hoạt động", "0", true);
             ddlStatus.Items.Add(inactive_v);
             break;
         case 2:
             ListItem all_e = new ListItem("--- All ---", "-1", true);
             all_e.Selected = true;
             ddlStatus.Items.Add(all_e);
             ListItem active_e = new ListItem("Active", "1", true);
             ddlStatus.Items.Add(active_e);
             ListItem inactive_e = new ListItem("Inactive", "0", true);
             ddlStatus.Items.Add(inactive_e);
             break;
         case 3:
             ListItem all_j = new ListItem("--- All ---", "-1", true);
             all_j.Selected = true;
             ddlStatus.Items.Add(all_j);
             ListItem active_j = new ListItem("Active", "1", true);
             ddlStatus.Items.Add(active_j);
             ListItem inactive_j = new ListItem("Inactive", "0", true);
             ddlStatus.Items.Add(inactive_j);
             break;
     }
 }
Ejemplo n.º 15
0
 public void bindDropDownList(DropDownList ddl, DataSet ds)
 {
     if (ds.Tables[0].Rows.Count > 0)
     {
         DataTable dt = ds.Tables[0];
         int count = dt.Rows.Count;
         int index = 0;
         while (index < count)
         {
             string str_displayYear = dt.Rows[index][2].ToString().Trim();
             string str_displayMonth = dt.Rows[index][1].ToString().Trim();
             if (str_displayMonth.Equals("10"))
                 str_displayYear = (int.Parse(str_displayYear) + 1).ToString().Trim();
             string str_display = date.getMeetingName(int.Parse(str_displayMonth)) + " " + str_displayYear;
             ddl.Items.Add(new ListItem(str_display, dt.Rows[index][0].ToString().Trim()));
             index++;
         }
         ddl.Enabled = true;
     }
     else
     {
         ddl.Items.Add(new ListItem("Not Exist", "-1"));
         ddl.Enabled = false;
     }
 }
 public int GetDropdownListBoxData(string controlId)
 {
     DropDownList _tempDDList = new DropDownList();
     _tempDDList = (DropDownList)FranchiseeFW.FindControl(controlId);
     //get the value
     return Convert.ToInt32(_tempDDList.SelectedValue.ToString());
 }
 void BindColumns(DropDownList combo)
 {
     //combo.DataSource = Page.ReportManager.RetrieveColumnsSchema(Page.Settings.Report.ReportTablesSchemaId);
     combo.DataSource = Page.Settings.Columns;
     combo.DataBind();
     combo.Items.Insert(0, new ListItem("- - - - - - - - - - - - - -", ""));
 }
        internal override void Awake()
        {
            settings = KSPAlternateResourcePanel.settings;

            TooltipMouseOffset = new Vector2d(-10, 10);

            ddlSettingsTab = new DropDownList(EnumExtensions.ToEnumDescriptions<SettingsTabs>(),this);

            ddlSettingsSkin = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.DisplaySkin>(), (Int32)settings.SelectedSkin,this);
            ddlSettingsSkin.OnSelectionChanged += ddlSettingsSkin_SelectionChanged;

            ddlSettingsAlarmsWarning = LoadSoundsList(Resources.clipAlarms.Keys.ToArray(),settings.AlarmsWarningSound);
            ddlSettingsAlarmsAlert = LoadSoundsList(Resources.clipAlarms.Keys.ToArray(), settings.AlarmsAlertSound);
            ddlSettingsAlarmsWarning.OnSelectionChanged += ddlSettingsAlarmsWarning_OnSelectionChanged;
            ddlSettingsAlarmsAlert.OnSelectionChanged += ddlSettingsAlarmsAlert_OnSelectionChanged;

            ddlSettingsRateStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.RateDisplayEnum>(),(Int32)settings.RateDisplayType, this);
            ddlSettingsRateStyle.OnSelectionChanged += ddlSettingsRateStyle_OnSelectionChanged;

            ddlSettingsButtonStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<ButtonStyleEnum>(), (Int32)settings.ButtonStyleChosen, this);
            ddlSettingsButtonStyle.OnSelectionChanged += ddlSettingsButtonStyle_OnSelectionChanged;

            ddlManager.AddDDL(ddlSettingsButtonStyle);
            ddlManager.AddDDL(ddlSettingsAlarmsWarning);
            ddlManager.AddDDL(ddlSettingsAlarmsAlert);
            ddlManager.AddDDL(ddlSettingsRateStyle);
            ddlManager.AddDDL(ddlSettingsTab);
            ddlManager.AddDDL(ddlSettingsSkin);
        }
Ejemplo n.º 19
0
 private void cargar_combo(DropDownList combo,String textField, String valueField)
 {
     combo.DataTextField = textField;
     combo.DataValueField = valueField;
     combo.DataBind();
     combo.SelectedIndex = 0;
 }
Ejemplo n.º 20
0
 public static void BindAdminRegionsDropDown(String empNo, Roles role, ICacheStorage adapter, DropDownList d)
 {
     d.DataSource = BllAdmin.GetRegionsByRights(empNo, role, adapter);
     d.DataTextField = "Value";
     d.DataValueField = "Key";
     d.DataBind();
 }
Ejemplo n.º 21
0
 public static void InicializaCombo(DropDownList ddl)
 {
     ddl.Items.Clear();
     ddl.DataValueField = "ID";
     ddl.DataTextField = "Nombre";
     ddl.Items.Add(new ListItem("Selecciona una opción:", "-1"));
 }
        internal override void Awake()
        {
            //WindowRect = new Rect(mbTWP.windowMain.WindowRect.x + mbTWP.windowMain.WindowRect.width, mbTWP.windowMain.WindowRect.y, 300, 200);
            WindowRect = new Rect(0, 0, WindowWidth, WindowHeight);
            settings = TransferWindowPlanner.settings;

            TooltipMouseOffset = new Vector2d(-10, 10);

            ddlSettingsTab = new DropDownList(EnumExtensions.ToEnumDescriptions<SettingsTabs>(), this);

            ddlSettingsSkin = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.DisplaySkin>(), (Int32)settings.SelectedSkin, this);
            ddlSettingsSkin.OnSelectionChanged += ddlSettingsSkin_SelectionChanged;
            ddlSettingsButtonStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.ButtonStyleEnum>(), (Int32)settings.ButtonStyleChosen, this);
            ddlSettingsButtonStyle.OnSelectionChanged += ddlSettingsButtonStyle_OnSelectionChanged;
            ddlSettingsCalendar = new DropDownList(EnumExtensions.ToEnumDescriptions<CalendarTypeEnum>(), this);
            //NOTE:Pull out the custom option for now
            ddlSettingsCalendar.Items.Remove(CalendarTypeEnum.Custom.Description());
            ddlSettingsCalendar.OnSelectionChanged += ddlSettingsCalendar_OnSelectionChanged;
            
            ddlManager.AddDDL(ddlSettingsCalendar);
            ddlManager.AddDDL(ddlSettingsButtonStyle);
            ddlManager.AddDDL(ddlSettingsSkin);
            ddlManager.AddDDL(ddlSettingsTab);

            onWindowVisibleChanged += TWPWindowSettings_onWindowVisibleChanged;
        }
Ejemplo n.º 23
0
    private void fillUnidades(DropDownList combo, int c)
    {
        combo.Enabled = false;
        combo.Items.Clear();
        combo.AppendDataBoundItems = true;
        combo.DataSource = psvm.getAllUnidades();
        combo.DataValueField = "UNI_COD";
        combo.DataTextField = "UNI_NOM";
        combo.DataBind();
        if (combo.Items.Count > 0)
        {
            combo.Enabled = true;

            cargo_comboUnidad_SelectedIndexChanged(combo, null);
        }
        else
        {
            combo.Enabled = false;

            combo.Items.Add(new ListItem("--Ninguno--", ""));
            cargo_comboArea.Enabled = false;
            cargo_comboArea.Items.Clear();
            cargo_comboArea.AppendDataBoundItems = true;
            cargo_comboArea.Items.Add(new ListItem("--Ninguno--", ""));
            cargo_comboArea.DataBind();

        }
    }
Ejemplo n.º 24
0
 public static void InitListLoaiXe(DropDownList ComboboxName)
 {
     string sql = string.Format(@"SELECT * FROM {0} tt
                  ORDER BY tt.{1}", LOAI_XE.sTableName, LOAI_XE.cl_LOAI_XE_ID);
     DataTable dt = SQLConnectWeb.GetTable(sql, LOAI_XE.sTableName);
     InitDropDownList(ComboboxName, dt, LOAI_XE.cl_LOAI_XE_ID, LOAI_XE.cl_TEN_LOAI);
 }
Ejemplo n.º 25
0
 public static void BindIndustry(DropDownList industryDropDownList)
 {
     industryDropDownList.DataValueField = "CategoryID";
     industryDropDownList.DataTextField = "CategoryName";
     industryDropDownList.DataSource = BindIndusty(HttpContext.Current.Session["LCID"].ToString());
     industryDropDownList.DataBind();
 }
Ejemplo n.º 26
0
        // 动态创建控件
        // 注意:这段代码需要每次加载页面都执行,因此不能放在 if(!IsPostBack) 逻辑判断中
        protected void Page_Init(object sender, EventArgs e)
        {
            // 创建一个 FormRow 控件并添加到 Form2
            FormRow row = new FormRow();
            row.ID = "rowUser";
            Form2.Rows.Add(row);

            TextBox tbxUser = new TextBox();
            tbxUser.ID = "tbxUserName";
            tbxUser.Text = "";
            tbxUser.Label = "用户名";
            tbxUser.ShowLabel = true;
            tbxUser.ShowRedStar = true;
            tbxUser.Required = true;
            row.Items.Add(tbxUser);

            DropDownList ddlGender = new DropDownList();
            ddlGender.ID = "ddlGender";
            ddlGender.Label = "性别(自动回发)";
            ddlGender.Items.Add("男", "0");
            ddlGender.Items.Add("女", "1");
            ddlGender.SelectedIndex = 0;
            ddlGender.AutoPostBack = true;
            ddlGender.SelectedIndexChanged += new EventHandler(ddlGender_SelectedIndexChanged);
            row.Items.Add(ddlGender);
        }
Ejemplo n.º 27
0
        private void dgApp_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) ||
                (e.Item.ItemType == ListItemType.AlternatingItem) ||
                (e.Item.ItemType == ListItemType.SelectedItem))
            {
                try
                {
                    int       indx    = e.Item.ItemIndex;
                    DataTable tbl     = (DataTable)dgApp.DataSource;
                    string    strCode = tbl.Rows[indx]["record_id"].ToString();


                    // create drop down
                    DropDownList ddl = new DropDownList();
                    ddl.CssClass = "fontsmall";
                    ddl.Width    = System.Web.UI.WebControls.Unit.Pixel(175);
                    ddl.ID       = "ddl_" + strCode;

                    ListItem li = new ListItem("View Summary", "0");
                    ddl.Items.Add(li);

                    ListItem li7 = new ListItem("Summary Report", "7");
                    ddl.Items.Add(li7);



                    ListItem li2 = new ListItem("Edit Request", "2");
                    ListItem li3 = new ListItem("Cancel Request", "3");
                    ListItem li4 = new ListItem("Reactivate Request", "4");

                    ListItem li6  = new ListItem("Edit/View Expenses", "6");
                    ListItem li9  = new ListItem("Review Eval.", "9");
                    ListItem li10 = new ListItem("Complete Eval.", "10");
                    ListItem li11 = new ListItem("Cancel Paid Request", "11");

                    switch (Convert.ToInt32(tbl.Rows[indx]["application_status"].ToString()))
                    {
                    case 0:
                        ddl.Items.Add(li2);
                        ddl.Items.Add(li3);
                        break;

                    case 1:
                        ddl.Items.Add(li2);
                        ddl.Items.Add(li3);
                        break;

                    case 2:
                        ddl.Items.Add(li2);
                        ddl.Items.Add(li3);
                        break;

                    case 3:
                        ddl.Items.Add(li11);
                        break;

                    case 4:
                        ddl.Items.Add(li4);
                        break;

                    case 23:
                        ddl.Items.Add(li4);
                        break;

                    case 5:
                        ddl.Items.Add(li9);
                        break;

                    case 6:
                        break;

                    case 10:
                        break;

                    case 11:
                        break;

                    case 12:
                        ddl.Items.Add(li2);
                        ddl.Items.Add(li3);
                        break;

                    case 13:
                        ddl.Items.Add(li2);
                        ddl.Items.Add(li3);
                        break;

                    case 17:
                        ddl.Items.Add(li10);
                        ddl.Items.Add(li11);
                        break;

                    case 18:
                        ddl.Items.Add(li9);
                        break;

                    case 19:
                        ddl.Items.Add(li10);
                        ddl.Items.Add(li11);
                        break;
                    }
                    ListItem li5 = new ListItem("Communication Module", "5");
                    ddl.Items.Add(li5);
                    ListItem li8 = new ListItem("View History", "8");
                    ddl.Items.Add(li8);

                    // create button
                    Button btn = new Button();
                    btn.CssClass = "actbtn_go_next_button";
                    btn.ID       = "btn_" + strCode;
                    btn.Text     = "Go";



                    btn.Click += new System.EventHandler(this.btnMenu_Click);
                    TableCell cell = e.Item.Cells[5];
                    cell.Controls.Add(ddl);
                    cell.Controls.Add(btn);
                }
                catch {}
            }
        }
    protected void btnsavedateclick_Click(object sender, EventArgs e)
    {
        try
        {
            string   fromyr     = Fromyear.SelectedItem.Value;
            string   toyr       = toyear.SelectedItem.Value;
            string   frommon    = frommonth.SelectedItem.Value;
            string   tomon      = tomonth.SelectedItem.Value;
            DateTime FCalYearDT = new DateTime(Convert.ToInt32(fromyr), Convert.ToInt32(frommon), 28);
            DateTime TCalYearDT = new DateTime(Convert.ToInt32(toyr), Convert.ToInt32(tomon), 28);
            DateTime DummyDT    = new DateTime();
            DummyDT    = FCalYearDT;
            DummyDT    = DummyDT.AddMonths(1);
            TCalYearDT = TCalYearDT.AddMonths(1);
            DataTable dtCol = new DataTable();
            dtCol.Columns.Add("S.No");
            dtCol.Columns.Add("MonthYear");
            dtCol.Columns.Add("Date");
            dtCol.Columns.Add("ChallanNo");
            dtCol.Columns.Add("MonthYearDb");
            DummyDT = DummyDT.AddMonths(-1);
            while (DummyDT < TCalYearDT)
            {
                DataRow dr = dtCol.NewRow();
                dr["MonthYear"]   = DummyDT.ToString("yyyy") + "-" + DummyDT.ToString("MM");
                dr["MonthYearDb"] = DummyDT.ToString("MM").TrimStart('0') + "/" + DummyDT.ToString("yyyy");
                dtCol.Rows.Add(dr);
                DummyDT = DummyDT.AddMonths(1);
            }
            if (Convert.ToString(ViewState["DateType"]) == "2")
            {
                griddate.Columns[3].Visible = true;
            }

            else
            {
                griddate.Columns[3].Visible = false;
            }
            btnsave.Visible     = true;
            griddate.Visible    = true;
            griddate.DataSource = dtCol;
            griddate.DataBind();

            ds.Clear();
            ds = d2.select_method_wo_parameter("select MasterCriteria1,MasterCriteriaValue1,MasterCriteriaValue2,MasterValue,MasterCriteria from CO_MasterValues where MasterCriteria in('Quarterly Report DepositDate','Quarterly Report Date') and collegecode='" + Convert.ToString(ddlcollege.SelectedItem.Value) + "' ", "text");
            string monYear = string.Empty;
            if (ds.Tables[0].Rows.Count > 0)
            {
                string LinkName = string.Empty;
                if (Convert.ToString(ViewState["DateType"]) == "1")
                {
                    LinkName = "Quarterly Report Date";
                }
                if (Convert.ToString(ViewState["DateType"]) == "2")
                {
                    LinkName = "Quarterly Report DepositDate";
                }
                foreach (GridViewRow dr in griddate.Rows)
                {
                    monYear = Convert.ToString((dr.FindControl("lbl_monthyear1") as Label).Text);
                    DataView dv = new DataView();
                    ds.Tables[0].DefaultView.RowFilter = " MasterValue='" + monYear + "' and MasterCriteria='" + LinkName + "'";
                    dv = ds.Tables[0].DefaultView;
                    if (dv.Count > 0)
                    {
                        for (int day = 0; day < dv.Count; day++)
                        {
                            if (LinkName == "Quarterly Report DepositDate")
                            {
                                string monthyearval  = Convert.ToString(dv[0]["MasterCriteriaValue2"]);
                                string monyeartxtval = string.Empty;
                                if (monthyearval.Contains('/'))
                                {
                                    string[] splitval = monthyearval.Split('/');
                                    monyeartxtval = Convert.ToString(splitval[1]) + "-" + Convert.ToString(splitval[0]);
                                }
                                TextBox txtmonyear = dr.FindControl("lbl_monthyear") as TextBox;
                                txtmonyear.Text = Convert.ToString(monyeartxtval);
                                string       Date = Convert.ToString(dv[0]["MasterCriteria1"]);
                                DropDownList ddl  = dr.FindControl("dddate") as DropDownList;
                                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(Date));

                                TextBox txtChallan = dr.FindControl("txtChallanNo") as TextBox;
                                txtChallan.Text = Convert.ToString(dv[0]["MasterCriteriaValue1"]);
                            }
                            else
                            {
                                string       Date = Convert.ToString(dv[0]["MasterCriteria1"]);
                                DropDownList ddl  = dr.FindControl("dddate") as DropDownList;
                                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(Date));

                                TextBox txtChallan = dr.FindControl("txtChallanNo") as TextBox;
                                txtChallan.Text = Convert.ToString(dv[0]["MasterCriteriaValue1"]);
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 29
0
        /// <summary>
        /// 得到类型名称
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public string GetTypeName(DropDownList ddl, string value)
        {
            ListItem item = ddl.Items.FindByValue(value);

            return(item == null ? value : item.Text);
        }
Ejemplo n.º 30
0
        protected void grdSecurityGroups_OnDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList ddl        = (DropDownList)e.Row.FindControl("ddlPrivacySettings");
                HiddenField  hf         = (HiddenField)e.Row.FindControl("hfPropertyURI");
                Label        items      = (Label)e.Row.FindControl("lblItems");
                Image        lockimage  = (Image)e.Row.FindControl("imgLock");
                Image        blankimage = (Image)e.Row.FindControl("imgBlank");
                SecurityItem si         = (SecurityItem)e.Row.DataItem;
                LinkButton   lb         = (LinkButton)e.Row.FindControl("lbUpdate");
                Literal      litSetting = (Literal)e.Row.FindControl("litSetting");

                string objecttype = string.Empty;

                items.Text = si.ItemCount.ToString();

                if (!si.CanEdit)
                {
                    lockimage.Visible  = true;
                    blankimage.Visible = true;
                }

                ddl.DataSource     = this.Dropdown;
                ddl.DataTextField  = "Text";
                ddl.DataValueField = "Value";
                ddl.DataBind();
                ddl.SelectedValue = si.PrivacyCode.ToString();
                ddl.Visible       = false;
                litSetting.Text   = si.PrivacyLevel;

                //ddl.Attributes.Add("onchange", "JavaScript:showstatus()");
                hf.Value = si.ItemURI;
                if (si.ItemURI.StartsWith(Profiles.ORNG.Utilities.OpenSocialManager.ORNG_ONTOLOGY_PREFIX))
                {
                    ((Control)e.Row.FindControl("imgOrng")).Visible = true;
                }


                switch (si.ObjectType)
                {
                case "1":
                    objecttype = "Literal";
                    break;

                case "0":
                    objecttype = "Entity";
                    break;
                }

                string editlink = "javascript:GoTo('" + Root.Domain + "/edit/default.aspx?subject=" + this.Subject.ToString() + "&predicateuri=" + hf.Value.Replace("#", "!") + "&module=DisplayItemToEdit&ObjectType=" + objecttype + "')";

                if (e.Row.RowState == DataControlRowState.Alternate)
                {
                    e.Row.Attributes.Add("onmouseover", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onmouseout", "doListTableRowOut(this,0);");
                    e.Row.Attributes.Add("onfocus", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onblur", "doListTableRowOut(this,0);");
                    e.Row.Attributes.Add("tabindex", "0");
                    e.Row.Attributes.Add("class", "evenRow");
                    e.Row.Attributes.Add("onclick", editlink);
                    e.Row.Attributes.Add("onkeypress", "if (event.keyCode == 13) " + editlink);
                    blankimage.ImageUrl = Root.Domain + "/edit/images/icons_blankAlt.gif";
                    blankimage.Attributes.Add("style", "opacity:0.0;filter:alpha(opacity=0);");
                }
                else
                {
                    e.Row.Attributes.Add("onmouseover", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onmouseout", "doListTableRowOut(this,1);");
                    e.Row.Attributes.Add("onfocus", "doListTableRowOver(this);");
                    e.Row.Attributes.Add("onblur", "doListTableRowOut(this,1);");
                    e.Row.Attributes.Add("tabindex", "0");
                    e.Row.Attributes.Add("class", "oddRow");
                    e.Row.Attributes.Add("onclick", editlink);
                    e.Row.Attributes.Add("onkeypress", "if (event.keyCode == 13) " + editlink);
                    blankimage.ImageUrl = Root.Domain + "/edit/images/icons_blankAlt.gif";
                    blankimage.Attributes.Add("style", "opacity:0.0;filter:alpha(opacity=0);");
                }

                e.Row.Cells[1].CssClass = "colItemCnt";
                e.Row.Cells[2].CssClass = "colSecurity";
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Decorates the givenn .net drop down list with the specified behaivour.
 /// </summary>
 /// <param name="ddl"></param>
 /// <param name="addNoneItem"></param>
 public ClienteDropDownListWrapper(DropDownList ddl, bool addNoneItem) : base(ddl)
 {
     AddNoneItem = addNoneItem;
 }
Ejemplo n.º 32
0
    protected void GridWork_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.Equals("AddNew"))
            {
                TextBox      TxtFtrStartTime = (TextBox)GridWork.FooterRow.FindControl("TxtFtrStartTime");
                TextBox      TxtFtrEndTime   = (TextBox)GridWork.FooterRow.FindControl("TxtFtrEndTime");
                TextBox      TxtFtrTotTime   = (TextBox)GridWork.FooterRow.FindControl("TxtFtrTotTime");
                DropDownList DDlFtrPrjName   = (DropDownList)GridWork.FooterRow.FindControl("DDlFtrPrjName");
                DropDownList DDlFtrModName   = (DropDownList)GridWork.FooterRow.FindControl("DDlFtrModName");
                TextBox      TxtFtrWorkDesc  = (TextBox)GridWork.FooterRow.FindControl("TxtFtrWorkDesc");
                DropDownList DDlFtrWorkStat  = (DropDownList)GridWork.FooterRow.FindControl("DDlFtrWorkStat");
                TextBox      TxtFtrRemark    = (TextBox)GridWork.FooterRow.FindControl("TxtFtrRemark");

                StrSql        = new StringBuilder();
                StrSql.Length = 0;

                StrSql.AppendLine("Insert Into DRFDET");
                StrSql.AppendLine("(DRFId,StartTime");
                StrSql.AppendLine(",EndTime,TotTime");
                StrSql.AppendLine(",Work_Desc");
                StrSql.AppendLine(",PrjId,PrjModId");
                StrSql.AppendLine(",WorkStatus,Remark");
                StrSql.AppendLine(",Entry_Date,Entry_Time");
                StrSql.AppendLine(",Entry_UID,UPDFLAG)");
                StrSql.AppendLine("Values");
                StrSql.AppendLine("(@DRFId,@StartTime");
                StrSql.AppendLine(",@EndTime,@TotTime");
                StrSql.AppendLine(",@Work_Desc");
                StrSql.AppendLine(",@PrjId,@PrjModId");
                StrSql.AppendLine(",@WorkStatus,@Remark");
                StrSql.AppendLine(",GETDATE(),CONVERT(VarChar,GETDATE(),108)");
                StrSql.AppendLine(",@Entry_UID,0)");

                Cmd = new SqlCommand(StrSql.ToString(), SqlFunc.gConn);

                Cmd.Parameters.AddWithValue("@DRFId", int.Parse(HidFldId.Value));

                Cmd.Parameters.AddWithValue("@StartTime", TxtFtrStartTime.Text);
                Cmd.Parameters.AddWithValue("@EndTime", TxtFtrEndTime.Text);
                Cmd.Parameters.AddWithValue("@TotTime", TxtFtrTotTime.Text);
                Cmd.Parameters.AddWithValue("@PrjId", DDlFtrPrjName.Text);
                Cmd.Parameters.AddWithValue("@PrjModId", DDlFtrModName.Text);
                Cmd.Parameters.AddWithValue("@Work_Desc", TxtFtrWorkDesc.Text);
                Cmd.Parameters.AddWithValue("@WorkStatus", DDlFtrWorkStat.Text);
                Cmd.Parameters.AddWithValue("@Remark", TxtFtrRemark.Text);
                Cmd.Parameters.AddWithValue("@Entry_UID", HidFldUID.Value);

                int result = SqlFunc.ExecuteNonQuery(Cmd);
                if (result == 1)
                {
                    FillWorkData();
                }
                else
                {
                    LblMsg.ForeColor = Color.Red;
                    LblMsg.Text      = "Work details not inserted";
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Ejemplo n.º 33
0
    }//end StringBuilder

    public static StringBuilder CreaEstructuraXML_Dropdownlist(GridView gv, int celdaDropDownList, string listaDesplegable, string tema, string elemento, NameValueCollection atributos)
    {
        string strInicioXML = "<" + tema + ">" + "\r\n";
        string strFinXML = "</" + tema + ">" + "\r\n";
        string texto;

        //Recorrer la rejilla para armar el archivo XML
        System.Text.StringBuilder SKUsXML = new System.Text.StringBuilder();
        Int16 i = default(Int16);

        try
        {
            SKUsXML.Append(strInicioXML);

            if (gv.Rows.Count > 0)
            {
                for (i = 0; i <= gv.Rows.Count - 1; i++) 
                {
                    SKUsXML.Append("<" + elemento + " ");

                    //Por cada atributo
                    for (int x = 0; x < atributos.Count; x++)
                    {
                        //Columnas 
                        Int32 y;
                        y = Convert.ToInt32(atributos.GetKey(x));

                        if (y == 0)
                        {
                            SKUsXML.Append(atributos.Get(x) + "=" + "\"" + gv.Rows[i].Cells[y].Text.Replace("ñ", "n").Replace("Ñ", "N") + "\"" + " ");
                        }
                        else if (y == 1)
                        {
                            DropDownList ddlgv = (DropDownList)gv.Rows[i].Cells[5].FindControl(listaDesplegable);
                            texto = ddlgv.SelectedValue;
                            texto = texto.Replace("ñ", "n");
                            texto = texto.Replace("Ñ", "N");

                            SKUsXML.Append(atributos.Get(x) + "=" + "\"" + texto + "\"" + " ");

                            SKUsXML.Append("/>" + "\r\n");
                        }

                    }//end for              
                
                }//end for                

                SKUsXML.Append(strFinXML);

            }//end if          

        }
        catch (Exception ex)
        {
            throw new Exception("Se ha producido un error en el metodo CreaEstructuraXML_Dropdownlist", ex);            

        }//end try

        return SKUsXML;

    }
Ejemplo n.º 34
0
        void EIWizard_ActiveStepChanged(object sender, EventArgs e)
        {
            BindStepsLabels();
            if (EIWizard.ActiveStep.ID == "step1")            //bind radio button list hints
            {
                if (IsProjectMSSynchronized || _toMSPrj)      // Sync mode
                {
                    divStep1NotSyncronized.Visible = false;
                    divStep1Syncronized.Visible    = true;
                    switch (rblFirstStep.SelectedValue)
                    {
                    case "UpdateInIBN":
                        lbSUpInIBN.Style.Add(HtmlTextWriterStyle.Display, "");
                        lbSUpInMS.Style.Add(HtmlTextWriterStyle.Display, "none");
                        break;

                    case "UpdateInMS":
                        lbSUpInIBN.Style.Add(HtmlTextWriterStyle.Display, "none");
                        lbSUpInMS.Style.Add(HtmlTextWriterStyle.Display, "");
                        break;
                    }
                }
                else                    // Update mode
                {
                    divStep1NotSyncronized.Visible = true;
                    divStep1Syncronized.Visible    = false;
                    switch (rblFirstStep.SelectedValue)
                    {
                    case "Import":
                        lbNSImport.Style.Add(HtmlTextWriterStyle.Display, "");
                        lbNSExport.Style.Add(HtmlTextWriterStyle.Display, "none");
                        break;

                    case "Export":
                        lbNSImport.Style.Add(HtmlTextWriterStyle.Display, "none");
                        lbNSExport.Style.Add(HtmlTextWriterStyle.Display, "");
                        break;
                    }
                }
            }

            if (EIWizard.ActiveStep.ID == "step3")
            {
                if (!Page.IsValid)
                {
                    EIWizard.MoveTo(this.step4);
                    return;
                }
                if (divStep3Synchronization.Visible)
                {
                    ddCType.Items.Clear();
                    ddCType.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tCTAll").ToString(), "All"));
                    ddCType.Items.Add(new ListItem(GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tCTAny").ToString(), "Any"));
                    BindDataGrid();
                    foreach (DataGridItem dgi in dgMembers.Items)
                    {
                        DropDownList ddl = (DropDownList)dgi.FindControl("ddProjectTeam");
                        CommonHelper.SafeSelect(ddl, dgi.Cells[3].Text);
                    }
                }
                if (divStep3Import.Visible)
                {
                    BindImportDataGrid();
                    foreach (DataGridItem dgi in dgMembersImport.Items)
                    {
                        DropDownList ddl = (DropDownList)dgi.FindControl("ddProjectTeam");
                        CommonHelper.SafeSelect(ddl, dgi.Cells[3].Text);
                    }
                }
            }
            if (EIWizard.ActiveStep.ID == "step4")
            {
                if (!Page.IsValid)
                {
                    ImportSuccessLiteral.Text = GetGlobalResourceObject("IbnFramework.ImportProjectWizard", "tWizardError").ToString();
                }

                if (divExportSuccess.Visible)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "OpenWindow('" + this.ResolveClientUrl("~/Projects/GetIBNProjectXML.aspx") + "?ProjectId=" + ProjectId.ToString() + (IsProjectMSSynchronized ? "&Synchronized=true" : "") + "',600,400);", true);
                }
            }
        }
Ejemplo n.º 35
0
        protected void ResultadosBusqueda_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            val = 0;
            try
            {
                DataTable dt = new DataTable();
                dt = (DataTable)ViewState["OPCIONESPERMISOS"];
                if (e.Row.RowIndex > -1)
                {
                    LinkButton[] lbmenu = new LinkButton[dt.Rows.Count];
                    for (int i = 0; i <= dt.Rows.Count - 1; i++)
                    {
                        lbmenu[i]                 = new LinkButton();
                        lbmenu[i].CommandName     = dt.Rows[i]["Opcion"].ToString();
                        lbmenu[i].CssClass        = (dt.Rows[i]["Imagen"].ToString());
                        lbmenu[i].CommandArgument = pos.ToString();
                        lbmenu[i].OnClientClick   = "return Dialogo();";

                        lbmenu[i].Command += ResultadosBusqueda_Command1;
                        lbmenu[i].Attributes.Add("cssclass", "text-custom");
                        lbmenu[i].Attributes.Add("data-toggle", "tooltip");
                        lbmenu[i].Attributes.Add("data-placement", "top");
                        lbmenu[i].Attributes.Add("data-original-title", dt.Rows[i]["ToolTip"].ToString());

                        if (int.Parse(System.Web.HttpUtility.HtmlDecode((e.Row.Cells[11].Text.ToString()))) < 2 && dt.Rows[i]["Opcion"].ToString() == "ServicioFiscaliaEmpresa")
                        {
                            lbmenu[i].Enabled       = false;
                            lbmenu[i].OnClientClick = "return false;";
                        }
                        if (int.Parse(System.Web.HttpUtility.HtmlDecode((e.Row.Cells[12].Text.ToString()))) < 2 && dt.Rows[i]["Opcion"].ToString() == "ServicioFiscaliaGarantia")
                        {
                            lbmenu[i].Enabled       = false;
                            lbmenu[i].OnClientClick = "return false;";
                        }

                        //SolicitudFiscalia
                        //if ((System.Web.HttpUtility.HtmlDecode((e.Row.Cells[11].Text.ToString())) == "2" || System.Web.HttpUtility.HtmlDecode((e.Row.Cells[12].Text.ToString())) == "2" ||
                        //    System.Web.HttpUtility.HtmlDecode((e.Row.Cells[11].Text.ToString())) == "3" || System.Web.HttpUtility.HtmlDecode((e.Row.Cells[12].Text.ToString())) == "3" ||
                        //    System.Web.HttpUtility.HtmlDecode((e.Row.Cells[11].Text.ToString())) == "4" || System.Web.HttpUtility.HtmlDecode((e.Row.Cells[12].Text.ToString())) == "4")
                        //    && dt.Rows[i]["Opcion"].ToString() == "SolicitudFiscalia")
                        //{
                        //    lbmenu[i].CssClass = (dt.Rows[i]["ImagenTrue"].ToString()); val++;
                        //}

                        //if (dt.Rows[i]["Opcion"].ToString() == "ENVIAR")
                        //{
                        //    lbmenu[i].CssClass = (dt.Rows[i]["ImagenTrue"].ToString());
                        //    lbmenu[i].Visible = true;
                        //}

                        //if (val <= 20 && dt.Rows[i]["Opcion"].ToString() == "ENVIAR")
                        //    lbmenu[i].Visible = false;

                        try
                        {
                            if (int.Parse(dt.Rows[0]["nroColum"].ToString()) == int.Parse(dt.Rows[i]["nroColum"].ToString()))
                            {
                                e.Row.Cells[int.Parse(dt.Rows[i]["nroColum"].ToString())].Controls.Add(lbmenu[i]);
                            }

                            if (int.Parse(dt.Rows[i]["nroColum"].ToString()) > int.Parse(dt.Rows[0]["nroColum"].ToString()) && int.Parse(e.Row.Cells[0].Text.ToString()) > 0)
                            {
                                e.Row.Cells[int.Parse(dt.Rows[i]["nroColum"].ToString())].Controls.Add(lbmenu[i]);
                            }
                        }
                        catch
                        {
                        }
                    }
                    pos++;

                    //Añadir DDL
                    DropDownList ddlUsuariosFiscalia = new DropDownList();
                    ddlUsuariosFiscalia.ID = "ddlUsuariosFiscalia";

                    //usuario responsable
                    String id;
                    ddlUsuariosFiscalia.Items.Clear();
                    ddlUsuariosFiscalia.DataSource     = dtUsuarioFiscalia;
                    ddlUsuariosFiscalia.DataValueField = "idUsuario";
                    ddlUsuariosFiscalia.DataTextField  = "nombreApellido";
                    ddlUsuariosFiscalia.DataBind();

                    ListItem li = new ListItem("Sin Asignar", "0");
                    ddlUsuariosFiscalia.Items.Insert(0, li);

                    foreach (DataRow row in dtUsuarioFiscalia.Rows)
                    {
                        id = row["idUsuario"].ToString().Trim();
                    }


                    if (string.IsNullOrWhiteSpace(System.Web.HttpUtility.HtmlDecode(e.Row.Cells[28].Text)) || System.Web.HttpUtility.HtmlDecode(e.Row.Cells[28].Text) == "Sin Asignar")
                    {
                        ddlUsuariosFiscalia.SelectedValue = "0";
                    }
                    else
                    {
                        ListItem itemAux = ddlUsuariosFiscalia.Items.FindByText(System.Web.HttpUtility.HtmlDecode(e.Row.Cells[28].Text));
                        if (itemAux != null)
                        {
                            itemAux.Selected = true;
                        }
                    }
                    e.Row.Cells[28].Controls.Add(ddlUsuariosFiscalia);


                    if (!string.IsNullOrEmpty(System.Web.HttpUtility.HtmlDecode(e.Row.Cells[30].Text)))
                    {
                        Label      cliente     = new Label();
                        LinkButton lbPrioridad = new LinkButton();
                        switch (e.Row.Cells[30].Text)
                        {
                        case "1":
                            lbPrioridad.ToolTip = "Prioridad Alta";
                            lbPrioridad.Attributes.Add("style", "color: red");
                            lbPrioridad.CssClass = ("glyphicon glyphicon-fire");
                            break;

                        case "2":
                            lbPrioridad.ToolTip = "Prioridad Media";
                            lbPrioridad.Attributes.Add("style", "color: #AEB404");
                            lbPrioridad.CssClass = ("glyphicon glyphicon-eye-open");
                            break;

                        case "3":
                            lbPrioridad.ToolTip = "Prioridad Baja";
                            lbPrioridad.Attributes.Add("style", "color: #298A08;");
                            lbPrioridad.CssClass = ("glyphicon glyphicon-leaf");
                            break;

                        default:

                            break;
                        }
                        lbPrioridad.Enabled = false;
                        cliente.Text        = e.Row.Cells[3].Text;
                        if (e.Row.Cells[30].Text != "100" && e.Row.Cells[30].Text != "&nbsp;")
                        {
                            lbPrioridad.Attributes.CssStyle.Add("margin-right", "10px");
                            e.Row.Cells[3].Controls.Add(lbPrioridad);
                        }
                        e.Row.Cells[3].Controls.Add(cliente);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingError.PostEventRegister(ex, ConfigurationManager.AppSettings["pathLog"].ToString(), "", "", ConfigurationManager.AppSettings["logName"].ToString(), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledLog"].ToString()), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledEventViewer"].ToString()), ConfigurationManager.AppSettings["registerEventsTypes"].ToString(), EventLogEntryType.Error);
            }
        }
Ejemplo n.º 36
0
    void grdWorkItem_GridRowDataBound(object sender, GridViewRowEventArgs e)
    {
        _columnData.SetupGridBody(e.Row);

        GridViewRow row = e.Row;

        formatColumnDisplay(ref row);

        string itemId = row.Cells[DCC.IndexOf("WorkItem_TestItemID")].Text.Trim();
        int    workItemID = 0, testItemID = 0;

        int.TryParse(row.Cells[DCC["WorkItem_Number"].Ordinal].Text.Trim(), out workItemID);
        int.TryParse(row.Cells[DCC["TestItem_Number"].Ordinal].Text.Trim(), out testItemID);
        if (itemId == "0")
        {
            row.Style["display"] = "none";
        }

        row.Attributes.Add("itemID", itemId);
        row.Attributes.Add("workItemID", workItemID.ToString());
        row.Attributes.Add("testItemID", testItemID.ToString());
        row.Attributes.Add("sourceType", this.SourceType);
        row.Cells[DCC.IndexOf("WorkItem_TestItemID")].Attributes.Add("sourceType", this.SourceType);

        string title   = row.Cells[DCC["WorkItem_Title"].Ordinal].Text.Trim();
        string tooltip = "";

        if (workItemID == 0)
        {
            //row.Cells[DCC["WorkItem_Number"].Ordinal].Text = "&nbsp;";
            TextBox txt = WTSUtility.CreateGridTextBox("WorkItem_Number", itemId, "", true);
            txt.Style["width"] = "75%";
            row.Cells[DCC["WorkItem_Number"].Ordinal].Controls.Add(txt);
            //row.Cells[DCC["WorkItem_Number"].Ordinal].Controls.Add(createRefreshButton("WorkItem", itemId, ""));
        }
        else
        {
            tooltip = string.Format("Work Item [{0}] - {1}", workItemID.ToString(), Server.HtmlDecode(title));
            row.Cells[DCC["WorkItem_Number"].Ordinal].Controls.Add(createEditLink_WorkItem(workItemID.ToString(), Server.HtmlDecode(title)));
            row.Cells[DCC["WorkItem_Number"].Ordinal].ToolTip = tooltip;
            //row.Cells[DCC["WorkItem_Number"].Ordinal].Controls.Add(createRefreshButton("WorkItem", itemId, ""));
        }

        title = row.Cells[DCC["TestItem_Title"].Ordinal].Text.Trim();
        if (testItemID == 0)
        {
            //row.Cells[DCC["TestItem_Number"].Ordinal].Text = "&nbsp;";
            row.Cells[DCC["TestItem_Number"].Ordinal].Controls.Add(WTSUtility.CreateGridTextBox("TestItem_Number", itemId, "", true));
            //row.Cells[DCC["TestItem_Number"].Ordinal].Controls.Add(createRefreshButton("TestItem", itemId, ""));
        }
        else
        {
            tooltip = string.Format("Test Item [{0}] - {1}", testItemID.ToString(), Server.HtmlDecode(title));
            row.Cells[DCC["TestItem_Number"].Ordinal].Controls.Add(createEditLink_WorkItem(testItemID.ToString(), Server.HtmlDecode(title)));
            row.Cells[DCC["TestItem_Number"].Ordinal].ToolTip = tooltip;
            //row.Cells[DCC["TestItem_Number"].Ordinal].Controls.Add(createRefreshButton("TestItem", itemId, ""));
        }

        if (_dsOptions != null && _dsOptions.Tables.Count > 0)
        {
            DropDownList ddl = null;
            if (_dsOptions.Tables.Contains("User"))
            {
                string resourceId = string.Empty, resource = string.Empty;

                resourceId = row.Cells[DCC["WorkItem_AssignedToID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["WorkItem_AssignedTo"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "WorkItem_AssignedTo", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["WorkItem_AssignedTo"].Ordinal].Controls.Add(ddl);

                resourceId = row.Cells[DCC["WorkItem_Primary_ResourceID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["WorkItem_Primary_Resource"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "WorkItem_Primary_Resource", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["WorkItem_Primary_Resource"].Ordinal].Controls.Add(ddl);

                resourceId = row.Cells[DCC["WorkItem_TesterID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["WorkItem_Tester"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "WorkItem_Tester", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["WorkItem_Tester"].Ordinal].Controls.Add(ddl);

                resourceId = row.Cells[DCC["TestItem_AssignedToID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["TestItem_AssignedTo"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "TestItem_AssignedTo", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["TestItem_AssignedTo"].Ordinal].Controls.Add(ddl);

                resourceId = row.Cells[DCC["TestItem_Primary_ResourceID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["TestItem_Primary_Resource"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "TestItem_Primary_Resource", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["TestItem_Primary_Resource"].Ordinal].Controls.Add(ddl);

                resourceId = row.Cells[DCC["TestItem_TesterID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resourceId = string.IsNullOrWhiteSpace(resourceId) ? "0" : resourceId;
                resource   = row.Cells[DCC["TestItem_Tester"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                resource   = string.IsNullOrWhiteSpace(resource) ? "-Select-" : resource;

                ddl = WTSUtility.CreateGridDropdownList(_dsOptions.Tables["User"], "TestItem_Tester", "USERNAME", "WTS_RESOURCEID", itemId, resourceId, resource);
                row.Cells[DCC["TestItem_Tester"].Ordinal].Controls.Add(ddl);
            }

            if (_dsOptions.Tables.Contains("Status"))
            {
                if (_dsOptions.Tables["Status"] != null && _dsOptions.Tables["Status"].Rows.Count > 0)
                {
                    DataTable dtTemp = _dsOptions.Tables["Status"];
                    //Work Item
                    string typeID = row.Cells[DCC["WorkItem_WorkTypeID"].Ordinal].Text.Replace("&nbsp;", "");
                    if (!string.IsNullOrWhiteSpace(typeID) && typeID != "0")
                    {
                        dtTemp.DefaultView.RowFilter = string.Format(" WorkTypeID = {0} ", row.Cells[DCC["WorkItem_WorkTypeID"].Ordinal].Text.Replace("&nbsp;", "").Trim());
                        dtTemp = dtTemp.DefaultView.ToTable();
                    }
                    else
                    {
                        dtTemp = dtTemp.DefaultView.ToTable(true, "STATUSID", "STATUS");
                    }
                    string id = string.Empty, value = string.Empty;

                    id    = row.Cells[DCC["WorkItem_STATUSID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                    id    = string.IsNullOrWhiteSpace(id) ? "0" : id;
                    value = row.Cells[DCC["WorkItem_STATUS"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                    value = string.IsNullOrWhiteSpace(value) ? "-Select-" : id;

                    ddl = WTSUtility.CreateGridDropdownList(dtTemp, "WorkItem_STATUS", "STATUS", "STATUSID", itemId, id, value);
                    row.Cells[DCC["WorkItem_STATUS"].Ordinal].Controls.Add(ddl);

                    //Test Item
                    dtTemp = _dsOptions.Tables["Status"];
                    typeID = row.Cells[DCC["TestItem_WorkTypeID"].Ordinal].Text.Replace("&nbsp;", "");
                    if (!string.IsNullOrWhiteSpace(typeID) && typeID != "0")
                    {
                        dtTemp.DefaultView.RowFilter = string.Format(" WorkTypeID = {0} ", row.Cells[DCC["TestItem_WorkTypeID"].Ordinal].Text.Replace("&nbsp;", "").Trim());
                        dtTemp = dtTemp.DefaultView.ToTable();
                    }
                    else
                    {
                        dtTemp = dtTemp.DefaultView.ToTable(true, "STATUSID", "STATUS");
                    }

                    id    = row.Cells[DCC["TestItem_STATUSID"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                    id    = string.IsNullOrWhiteSpace(id) ? "0" : id;
                    value = row.Cells[DCC["TestItem_STATUS"].Ordinal].Text.Replace("&nbsp;", " ").Trim();
                    value = string.IsNullOrWhiteSpace(value) ? "-Select-" : id;

                    ddl = WTSUtility.CreateGridDropdownList(dtTemp, "TestItem_STATUS", "STATUS", "STATUSID", itemId, id, value);
                    row.Cells[DCC["TestItem_STATUS"].Ordinal].Controls.Add(ddl);
                }
            }

            if (_dsOptions.Tables.Contains("PercentComplete"))
            {
                row.Cells[DCC["WorkItem_Progress"].Ordinal].Controls.Add(
                    WTSUtility.CreateGridDropdownList(_dsOptions.Tables["PercentComplete"], "WorkItem_Progress", "Percent", "Percent", itemId, row.Cells[DCC["WorkItem_Progress"].Ordinal].Text.Trim(), row.Cells[DCC.IndexOf("WorkItem_Progress")].Text.Trim()));
                row.Cells[DCC["TestItem_Progress"].Ordinal].Controls.Add(
                    WTSUtility.CreateGridDropdownList(_dsOptions.Tables["PercentComplete"], "TestItem_Progress", "Percent", "Percent", itemId, row.Cells[DCC["TestItem_Progress"].Ordinal].Text.Trim(), row.Cells[DCC.IndexOf("TestItem_Progress")].Text.Trim()));
            }

            if (!CanEdit)
            {
                Image imgBlank = new Image();
                imgBlank.Height        = 10;
                imgBlank.Width         = 10;
                imgBlank.ImageUrl      = "Images/Icons/blank.png";
                imgBlank.AlternateText = "";
                row.Cells[DCC["Y"].Ordinal].Controls.Add(imgBlank);
            }
            else
            {
                row.Cells[DCC["Y"].Ordinal].Controls.Add(WTSUtility.CreateGridDeleteButton(itemId));
            }
        }
    }
Ejemplo n.º 37
0
    protected void mlDDLPAGESIZE_SelectedIndexChanged(Object sender, EventArgs e)
    {
        DropDownList mlDDL = (DropDownList)sender;

        PageSizeGrid(Convert.ToInt32(mlDDL.SelectedItem.Text));
    }
Ejemplo n.º 38
0
    protected void btnAddRow_Click(object sender, EventArgs e)
    {
        GridViewRow  gvrow                 = (GridViewRow)(((Control)sender).NamingContainer);
        DropDownList ddlSpareCode          = (DropDownList)gvrow.FindControl("ddlSpareCode");
        TextBox      lblCurrentStock       = (TextBox)gvrow.FindControl("lblCurrentStock");
        DropDownList ddlLocation           = (DropDownList)gvrow.FindControl("ddlLocation");
        TextBox      lblStockAsPerLocation = (TextBox)gvrow.FindControl("lblStockAsPerLocation");
        DropDownList ddlDefLocation        = (DropDownList)gvrow.FindControl("ddlDefLocation");
        TextBox      txtQuantity           = (TextBox)gvrow.FindControl("txtQuantity");
        DropDownList ddlActionType         = (DropDownList)gvrow.FindControl("ddlActionType");
        TextBox      txtComments           = (TextBox)gvrow.FindControl("txtComments");

        if ((Convert.ToInt32(lblStockAsPerLocation.Text) < Convert.ToInt32(txtQuantity.Text)) && (ddlActionType.SelectedItem.Value == "2"))
        {
            ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('Entered Qty should not be greater than available qty.');", true);
            return;
        }
        DataTable dtCurrentTable;

        if (ViewState["DataTableSpareSalePurchaseByASC"] != null)
        {
            dtCurrentTable = (DataTable)ViewState["DataTableSpareSalePurchaseByASC"];
        }
        else
        {
            dtCurrentTable = new DataTable();
        }
        int  ConsumeSpareId = Convert.ToInt32(ddlSpareCode.SelectedValue);
        bool blnIsUpdate    = true;

        for (int i = 0; i < GvSpareSalePurchaseByASC.Rows.Count; i++)
        {
            if (i != gvrow.RowIndex)
            {
                int PreConsumeSpareId = Convert.ToInt32(GvSpareSalePurchaseByASC.Rows[i].Cells[9].Text);
                if (PreConsumeSpareId == 0)
                {
                    PreConsumeSpareId = Convert.ToInt32(GvSpareSalePurchaseByASC.Rows[i].Cells[9].Text);
                }
                if (ConsumeSpareId == PreConsumeSpareId)
                {
                    blnIsUpdate = false;
                    //ScriptManager.RegisterClientScriptBlock(btnAddRow_Click, GetType(), "Spare", "alert('Same Spare can not be entered.');", true);
                }
            }
        }


        if (blnIsUpdate == true)
        {
            DataRow drCurrentRow = dtCurrentTable.NewRow();
            drCurrentRow["Spare_Id"]         = ddlSpareCode.SelectedItem.Value;
            drCurrentRow["Spare"]            = ddlSpareCode.SelectedItem.Text;
            drCurrentRow["Current_Stock"]    = lblCurrentStock.Text;
            drCurrentRow["Loc_Id"]           = ddlLocation.SelectedItem.Value;
            drCurrentRow["Location"]         = ddlLocation.SelectedItem.Text;
            drCurrentRow["QtyAsPerLocation"] = lblStockAsPerLocation.Text;
            drCurrentRow["Def_Loc_Id"]       = ddlDefLocation.SelectedItem.Value;
            drCurrentRow["Def_Location"]     = ddlDefLocation.SelectedItem.Text;
            drCurrentRow["Quantity"]         = txtQuantity.Text;
            drCurrentRow["Action_Type_Id"]   = ddlActionType.SelectedItem.Value;
            drCurrentRow["Action_Type"]      = ddlActionType.SelectedItem.Text;
            drCurrentRow["Comments"]         = txtComments.Text.Trim();

            dtCurrentTable.Rows.InsertAt(drCurrentRow, dtCurrentTable.Rows.Count - 1);
            ViewState["DataTableSpareSalePurchaseByASC"] = dtCurrentTable;
            ViewState["EditIndex"] = dtCurrentTable.Rows.Count - 1;

            GvSpareSalePurchaseByASC.EditIndex  = dtCurrentTable.Rows.Count - 1;
            GvSpareSalePurchaseByASC.DataSource = dtCurrentTable;
            GvSpareSalePurchaseByASC.DataBind();
            FillDropDowns();
        }
        FillDropDownToolTip();
    }
Ejemplo n.º 39
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable    dtCurrentTable        = (DataTable)ViewState["DataTableSpareSalePurchaseByASC"];
            GridViewRow  gvrow                 = (GridViewRow)GvSpareSalePurchaseByASC.Rows[GvSpareSalePurchaseByASC.EditIndex];
            DropDownList ddlSpareCode          = (DropDownList)gvrow.FindControl("ddlSpareCode");
            DropDownList ddlActionType         = (DropDownList)gvrow.FindControl("ddlActionType");
            TextBox      lblCurrentStock       = (TextBox)gvrow.FindControl("lblCurrentStock");
            DropDownList ddlLocation           = (DropDownList)gvrow.FindControl("ddlLocation");
            TextBox      lblStockAsPerLocation = (TextBox)gvrow.FindControl("lblStockAsPerLocation");
            DropDownList ddlDefLocation        = (DropDownList)gvrow.FindControl("ddlDefLocation");
            TextBox      txtQuantity           = (TextBox)gvrow.FindControl("txtQuantity");
            TextBox      txtComments           = (TextBox)gvrow.FindControl("txtComments");

            if (ddlSpareCode.SelectedIndex > 0)
            {
                if (lblCurrentStock.Text.Trim() == "" || txtQuantity.Text.Trim() == "" || lblStockAsPerLocation.Text.Trim() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('First, complete the values in last row.');", true);
                    return;
                }
                if ((Convert.ToInt32(lblStockAsPerLocation.Text) < Convert.ToInt32(txtQuantity.Text)) && (ddlActionType.SelectedItem.Value == "2"))
                {
                    ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('In last row, entered qty should not be greater than available qty.');", true);
                    return;
                }
                if (txtComments.Text.Trim() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('In last row, please enter the comments.');", true);
                    return;
                }
                DataRow drCurrentRow = dtCurrentTable.NewRow();
                drCurrentRow["Spare_Id"]         = ddlSpareCode.SelectedItem.Value;
                drCurrentRow["Spare"]            = ddlSpareCode.SelectedItem.Text;
                drCurrentRow["Current_Stock"]    = lblCurrentStock.Text;
                drCurrentRow["Loc_Id"]           = ddlLocation.SelectedItem.Value;
                drCurrentRow["Location"]         = ddlLocation.SelectedItem.Text;
                drCurrentRow["QtyAsPerLocation"] = lblStockAsPerLocation.Text;
                drCurrentRow["Def_Loc_Id"]       = ddlDefLocation.SelectedItem.Value;
                drCurrentRow["Def_Location"]     = ddlDefLocation.SelectedItem.Text;
                drCurrentRow["Quantity"]         = txtQuantity.Text;
                drCurrentRow["Action_Type_Id"]   = ddlActionType.SelectedItem.Value;
                drCurrentRow["Action_Type"]      = ddlActionType.SelectedItem.Text;
                drCurrentRow["Comments"]         = txtComments.Text.Trim();

                dtCurrentTable.Rows.InsertAt(drCurrentRow, dtCurrentTable.Rows.Count - 1);
                ViewState["DataTableSpareSalePurchaseByASC"] = dtCurrentTable;
            }
            if (dtCurrentTable != null)
            {
                if (ddlMovType.SelectedValue == "1")
                {
                    objSpareSalePurchaseByASC.PrefixString        = "SAL";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                else if (ddlMovType.SelectedValue == "2")
                {
                    objSpareSalePurchaseByASC.PrefixString        = "PUR";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                else if (ddlMovType.SelectedValue == "3")
                {
                    objSpareSalePurchaseByASC.PrefixString        = "WRF";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                else if (ddlMovType.SelectedValue == "4")
                {
                    objSpareSalePurchaseByASC.PrefixString        = "SAN";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                else if (ddlMovType.SelectedValue == "5")
                {
                    objSpareSalePurchaseByASC.PrefixString        = "GTD";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                else
                {
                    objSpareSalePurchaseByASC.PrefixString        = "OTH";
                    objSpareSalePurchaseByASC.AutoGeneratedNumber = objSpareSalePurchaseByASC.GetAutoGeneratedNumber();
                }
                bool blnSaved = false;
                for (int i = 0; i < dtCurrentTable.Rows.Count - 1; i++)
                {
                    objSpareSalePurchaseByASC.Asc_Code           = Convert.ToInt32(hdnASC_Code.Value);
                    objSpareSalePurchaseByASC.ProductDivision_Id = Convert.ToInt32(ddlProdDivision.SelectedValue);
                    objSpareSalePurchaseByASC.Mov_Type_Id        = Convert.ToInt32(ddlMovType.SelectedValue);
                    objSpareSalePurchaseByASC.Mov_Type_Text      = ddlMovType.SelectedItem.Text;
                    objSpareSalePurchaseByASC.VendorId           = Convert.ToInt32(ddlVendor.SelectedValue);
                    objSpareSalePurchaseByASC.SpareId            = Convert.ToInt32(dtCurrentTable.Rows[i]["Spare_Id"].ToString());
                    objSpareSalePurchaseByASC.CurrentStock       = Convert.ToInt32(dtCurrentTable.Rows[i]["Current_Stock"].ToString());
                    objSpareSalePurchaseByASC.Loc_Id             = Convert.ToInt32(dtCurrentTable.Rows[i]["Loc_Id"].ToString());
                    objSpareSalePurchaseByASC.StockAsPerLocation = Convert.ToInt32(dtCurrentTable.Rows[i]["QtyAsPerLocation"].ToString());
                    objSpareSalePurchaseByASC.Def_Loc_Id         = Convert.ToInt32(dtCurrentTable.Rows[i]["Def_Loc_Id"].ToString());
                    objSpareSalePurchaseByASC.Quantity           = Convert.ToInt32(dtCurrentTable.Rows[i]["Quantity"].ToString());
                    objSpareSalePurchaseByASC.Action_Type_Id     = Convert.ToInt32(dtCurrentTable.Rows[i]["Action_Type_Id"].ToString());
                    objSpareSalePurchaseByASC.Comments           = dtCurrentTable.Rows[i]["Comments"].ToString();
                    //INSERT DATA Spare_Sale_Purchase_ASC TABLE
                    string strMsg = objSpareSalePurchaseByASC.SaveData("UPDATE_QTY_OF_ALL_STORAGE_LOCATIONS");
                    if (objSpareSalePurchaseByASC.ReturnValue == -1)
                    {
                        lblMessage.Text = SIMSCommonClass.getErrorWarrning(SIMSenuErrorWarrning.ErrorInStoreProc, SIMSenuMessageType.Error, false, "");
                    }
                    else
                    {
                        lblMessage.Text = SIMSCommonClass.getErrorWarrning(SIMSenuErrorWarrning.AddRecord, SIMSenuMessageType.UserMessage, false, "");
                    }
                    blnSaved = true;
                    // END
                }
                if (blnSaved == true)
                {
                    trTransaction.Visible = true;
                    lblTransactionNo.Text = objSpareSalePurchaseByASC.AutoGeneratedNumber;

                    ddlSpareCode.Items.Clear();
                    ddlSpareCode.Items.Insert(0, new ListItem("Select", "0"));
                    ddlActionType.Items.Clear();
                    ddlActionType.Items.Insert(0, new ListItem("Select", "0"));
                    ddlDefLocation.Items.Clear();
                    ddlDefLocation.Items.Insert(0, new ListItem("Select", "0"));
                    ddlLocation.Items.Clear();
                    ddlLocation.Items.Insert(0, new ListItem("Select", "0"));
                    lblCurrentStock.Text       = "";
                    lblStockAsPerLocation.Text = "";
                    txtQuantity.Text           = "";
                    txtComments.Text           = "";
                    btnConfirm.Enabled         = false;
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('First, complete the values in last row.');", true);
                }
            }

            //ddlProdDivision.SelectedIndex = 0;
            //ddlMovType.SelectedIndex = 0;
            //ddlVendor.SelectedIndex = 0;
            //txtMovDate.Text = "";
        }
        catch (Exception ex)
        {
            SIMSCommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
            ScriptManager.RegisterClientScriptBlock(btnConfirm, GetType(), "Spare", "alert('First, complete the values in last row.');", true);
            //lblMessage.Text = "Please enter proper values in last row.";
        }
        FillDropDownToolTip();
    }
Ejemplo n.º 40
0
        private void btnMenu_Click(object sender, System.EventArgs e)
        {
            SQLStatic.Sessions.SetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "InView", "F", Training_Source.TrainingClass.ConnectioString);
            SQLStatic.Sessions.SetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "Expense", "F", Training_Source.TrainingClass.ConnectioString);
            string    strIndex = ((Button)sender).ID.Substring(4);
            DataTable dt       = (DataTable)dgApp.DataSource;

            SQLStatic.Sessions.SetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "Initial_Status", SelectedStatus(dt, strIndex), Training_Source.TrainingClass.ConnectioString);
            DropDownList ddl = GetDropDown(this, "ddl_" + strIndex);

            ViewState["Request_Record_ID"] = strIndex;
            SQLStatic.Sessions.SetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "Request_Record_ID", ViewState["Request_Record_ID"].ToString(), Training_Source.TrainingClass.ConnectioString);
            if (ddl.SelectedValue == "0")
            {
                ViewSummary();
            }
            else if (ddl.SelectedValue == "1")
            {
                ViewProcessingSteps();
            }
            else if (ddl.SelectedValue == "2")
            {
                EditSteps(BookRequest(dt, strIndex));
            }
            else if (ddl.SelectedValue == "3")
            {
                CancelSteps();
            }
            else if (ddl.SelectedValue == "4")
            {
                RectivateRequest();
            }
            else if (ddl.SelectedValue == "5")
            {
                CommunicationModule();
            }
            else if (ddl.SelectedValue == "6")
            {
                EditExpense();
            }
            else if (ddl.SelectedValue == "7")
            {
                string strURL = "/web_projects/trn/PLA_Report/Training_Request_Summary.aspx?hedID=" + strIndex +
                                "&BackTo=" + Request.Path;
                Response.Redirect(strURL);
            }
            else if (ddl.SelectedValue == "8")
            {
                ViewHistory();
            }
            else if (ddl.SelectedValue == "9")
            {
                ViewReviewEval();
            }
            else if (ddl.SelectedValue == "10")
            {
                CompleteEval();
            }
            else if (ddl.SelectedValue == "11")
            {
                CancelPaidRequest();
            }
//			lnkbtnSaveAndNext_Click(null,null);
        }
Ejemplo n.º 41
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                try
                {
                    // 01/16/2006 Paul.  Enable validator before validating page.
                    SplendidDynamic.ValidateEditViewFields(m_sMODULE + ".EditView", this);
                    if (Page.IsValid)
                    {
                        DataTable         dtACLACCESS = null;
                        DbProviderFactory dbf         = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            con.Open();
                            string sSQL;
                            sSQL = "select MODULE_NAME          " + ControlChars.CrLf
                                   + "     , DISPLAY_NAME         " + ControlChars.CrLf
                                   + "     , ACLACCESS_ADMIN      " + ControlChars.CrLf
                                   + "     , ACLACCESS_ACCESS     " + ControlChars.CrLf
                                   + "     , ACLACCESS_VIEW       " + ControlChars.CrLf
                                   + "     , ACLACCESS_LIST       " + ControlChars.CrLf
                                   + "     , ACLACCESS_EDIT       " + ControlChars.CrLf
                                   + "     , ACLACCESS_DELETE     " + ControlChars.CrLf
                                   + "     , ACLACCESS_IMPORT     " + ControlChars.CrLf
                                   + "     , ACLACCESS_EXPORT     " + ControlChars.CrLf
                                   + "  from vwACL_ACCESS_ByModule" + ControlChars.CrLf
                                   + " order by MODULE_NAME       " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                using (DbDataAdapter da = dbf.CreateDataAdapter())
                                {
                                    ((IDbDataAdapter)da).SelectCommand = cmd;
                                    dtACLACCESS = new DataTable();
                                    da.Fill(dtACLACCESS);
                                }
                            }

                            string    sCUSTOM_MODULE = "ACL_ROLES";
                            DataTable dtCustomFields = SplendidCache.FieldsMetaData_Validated(sCUSTOM_MODULE);
                            using (IDbTransaction trn = con.BeginTransaction())
                            {
                                try
                                {
                                    SqlProcs.spACL_ROLES_Update(ref gID
                                                                , new DynamicControl(this, "NAME").Text
                                                                , new DynamicControl(this, "DESCRIPTION").Text
                                                                , trn
                                                                );
                                    SplendidDynamic.UpdateCustomFields(this, trn, gID, sCUSTOM_MODULE, dtCustomFields);

                                    foreach (DataRow row in dtACLACCESS.Rows)
                                    {
                                        string sMODULE_NAME = Sql.ToString(row["MODULE_NAME"]);
                                        // 04/25/2006 Paul.  FindControl needs to be executed on the DataGridItem.  I'm not sure why.
                                        DropDownList lstAccess       = lstAccess = ctlAccessView.FindACLControl(sMODULE_NAME, "access");
                                        DropDownList lstView         = ctlAccessView.FindACLControl(sMODULE_NAME, "view");
                                        DropDownList lstList         = ctlAccessView.FindACLControl(sMODULE_NAME, "list");
                                        DropDownList lstEdit         = ctlAccessView.FindACLControl(sMODULE_NAME, "edit");
                                        DropDownList lstDelete       = ctlAccessView.FindACLControl(sMODULE_NAME, "delete");
                                        DropDownList lstImport       = ctlAccessView.FindACLControl(sMODULE_NAME, "import");
                                        DropDownList lstExport       = ctlAccessView.FindACLControl(sMODULE_NAME, "export");
                                        Guid         gActionAccessID = Guid.Empty;
                                        Guid         gActionViewID   = Guid.Empty;
                                        Guid         gActionListID   = Guid.Empty;
                                        Guid         gActionEditID   = Guid.Empty;
                                        Guid         gActionDeleteID = Guid.Empty;
                                        Guid         gActionImportID = Guid.Empty;
                                        Guid         gActionExportID = Guid.Empty;
                                        if (lstAccess != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionAccessID, gID, "access", sMODULE_NAME, Sql.ToInteger(lstAccess.SelectedValue), trn);
                                        }
                                        if (lstView != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionViewID, gID, "view", sMODULE_NAME, Sql.ToInteger(lstView.SelectedValue), trn);
                                        }
                                        if (lstList != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionListID, gID, "list", sMODULE_NAME, Sql.ToInteger(lstList.SelectedValue), trn);
                                        }
                                        if (lstEdit != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionEditID, gID, "edit", sMODULE_NAME, Sql.ToInteger(lstEdit.SelectedValue), trn);
                                        }
                                        if (lstDelete != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionDeleteID, gID, "delete", sMODULE_NAME, Sql.ToInteger(lstDelete.SelectedValue), trn);
                                        }
                                        if (lstImport != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionImportID, gID, "import", sMODULE_NAME, Sql.ToInteger(lstImport.SelectedValue), trn);
                                        }
                                        if (lstExport != null)
                                        {
                                            SqlProcs.spACL_ROLES_ACTIONS_Update(ref gActionExportID, gID, "export", sMODULE_NAME, Sql.ToInteger(lstExport.SelectedValue), trn);
                                        }
                                        //break;
                                    }
                                    trn.Commit();
                                }
                                catch (Exception ex)
                                {
                                    trn.Rollback();
                                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                                    ctlEditButtons.ErrorText = ex.Message;
                                    return;
                                }
                            }
                        }
                        Response.Redirect("view.aspx?ID=" + gID.ToString());
                    }
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                    ctlEditButtons.ErrorText = ex.Message;
                }
            }
            else if (e.CommandName == "Cancel")
            {
                if (Sql.IsEmptyGuid(gID))
                {
                    Response.Redirect("default.aspx");
                }
                else
                {
                    Response.Redirect("view.aspx?ID=" + gID.ToString());
                }
            }
        }
        protected override void InstantiateControlIn(Control container)
        {
            ListControl listControl;

            switch (Metadata.ControlStyle)
            {
            case WebFormMetadata.ControlStyle.VerticalRadioButtonList:
                listControl = new RadioButtonList
                {
                    ID              = ControlID,
                    CssClass        = string.Join(" ", "picklist", "vertical", Metadata.CssClass),
                    ToolTip         = Metadata.ToolTip,
                    RepeatDirection = RepeatDirection.Vertical,
                    RepeatLayout    = RepeatLayout.Flow
                };
                break;

            case WebFormMetadata.ControlStyle.HorizontalRadioButtonList:
                listControl = new RadioButtonList
                {
                    ID              = ControlID,
                    CssClass        = string.Join(" ", "picklist", "horizontal", Metadata.CssClass),
                    ToolTip         = Metadata.ToolTip,
                    RepeatDirection = RepeatDirection.Horizontal,
                    RepeatLayout    = RepeatLayout.Flow
                };
                break;

            case WebFormMetadata.ControlStyle.MultipleChoiceMatrix:
                listControl = new RadioButtonList
                {
                    ID              = ControlID,
                    CssClass        = string.Join(" ", "picklist", "horizontal", "labels-top", Metadata.CssClass),
                    ToolTip         = Metadata.ToolTip,
                    RepeatDirection = RepeatDirection.Horizontal,
                    RepeatLayout    = RepeatLayout.Table,
                    TextAlign       = TextAlign.Left
                };
                break;

            default:
                listControl = new DropDownList
                {
                    ID       = ControlID,
                    CssClass = string.Join(" ", "form-control", CssClass, Metadata.CssClass),
                    ToolTip  = Metadata.ToolTip
                };
                break;
            }

            if (listControl is RadioButtonList)
            {
                listControl.Attributes.Add("role", "presentation");
            }

            listControl.Attributes.Add("onchange", "setIsDirty(this.id);");

            container.Controls.Add(listControl);

            PopulateListControl(listControl);

            if (Metadata.IsRequired || Metadata.WebFormForceFieldIsRequired)
            {
                switch (Metadata.ControlStyle)
                {
                case WebFormMetadata.ControlStyle.VerticalRadioButtonList:
                case WebFormMetadata.ControlStyle.HorizontalRadioButtonList:
                case WebFormMetadata.ControlStyle.MultipleChoiceMatrix:
                    listControl.Attributes.Add("data-required", "true");
                    break;

                default:
                    listControl.Attributes.Add("required", string.Empty);
                    break;
                }
            }

            if (Metadata.ReadOnly)
            {
                AddSpecialBindingAndHiddenFieldsToPersistDisabledSelect(container, listControl);
            }
            else
            {
                Bindings[Metadata.DataFieldName] = new CellBinding
                {
                    Get = () =>
                    {
                        int value;
                        return(int.TryParse(listControl.SelectedValue, out value) ? new int?(value) : null);
                    },
                    Set = obj =>
                    {
                        var value    = ((OptionSetValue)obj).Value;
                        var listItem = listControl.Items.FindByValue(value.ToString(CultureInfo.InvariantCulture));
                        if (listItem != null)
                        {
                            listControl.ClearSelection();
                            listItem.Selected = true;
                        }
                    }
                };
            }
        }
Ejemplo n.º 43
0
    protected void ddlPhone_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = sender as DropDownList;

        PK_ParticipantWAC_Phone = Convert.ToInt32(ddl.SelectedValue);
    }
Ejemplo n.º 44
0
    private TableRow CreateMedicationRow(int rowIndex, ref string myscript)
    {
        try
        {
            HiddenField textboxButtonValue = this.Page.FindControl("txtButtonValue") as HiddenField;

            CommonFunctions.Event_Trap(this);
            Table _Table = new Table();
            TableRow _TableRow = new TableRow();
            _TableRow.ID = "TableMedicationRow_" + rowIndex;
            TableCell _TableCell0 = new TableCell();
            TableCell _TableCell1 = new TableCell();
            TableCell _TableCell2 = new TableCell();
            TableCell _TableCell3 = new TableCell();
            TableCell _TableCell4 = new TableCell();
            TableCell _TableCell5 = new TableCell();
            TableCell _TableCell6 = new TableCell();
            TableCell _TableCell7 = new TableCell();
            TableCell _TableCell8 = new TableCell();
            //Added in ref to Task#2802
            TableCell _TableCell9 = new TableCell();
            _Table.ID = "TableMedication" + rowIndex;


            HtmlImage _ImgDeleteRow = new HtmlImage();
            _ImgDeleteRow.ID = "ImageDelete" + rowIndex;
            _ImgDeleteRow.Src = "~/App_Themes/Includes/Images/deleteIcon.gif";
            _ImgDeleteRow.Attributes.Add("class", "handStyle");
            if (textboxButtonValue != null && textboxButtonValue.Value == "Refill")
                _ImgDeleteRow.Disabled = true;


            myscript += "var Imagecontext" + rowIndex + ";";
            myscript += "var ImageclickCallback" + rowIndex + " =";
            myscript += " Function.createCallback(ClientMedicationTitration.DeleteRow , Imagecontext" + rowIndex + ");";
            myscript += "$addHandler($get('" + _ImgDeleteRow.ClientID + "'), 'click', ImageclickCallback" + rowIndex + ");";


            DropDownList _DropDownListStrength = new DropDownList();
            //Modified by Loveena in ref to Task#2799 to change the labels
            //_DropDownListStrength.Width = 270;
            _DropDownListStrength.Width = 190;
            _DropDownListStrength.Height = 20;
            if (textboxButtonValue != null && textboxButtonValue.Value == "Refill")
                _DropDownListStrength.Enabled = false;
            _DropDownListStrength.EnableViewState = true;
            _DropDownListStrength.ID = "DropDownListStrength" + rowIndex;


            TextBox _txtQuantity = new TextBox();
            _txtQuantity.BackColor = System.Drawing.Color.White;
            _txtQuantity.MaxLength = 4;
            if (textboxButtonValue != null && textboxButtonValue.Value == "Refill")
                _txtQuantity.Enabled = false;
            _txtQuantity.ID = "TextBoxQuantity" + rowIndex;
            _txtQuantity.Width = 30;
            _txtQuantity.Height = 20;
            _txtQuantity.Visible = true;
            _txtQuantity.Style["text-align"] = "Right";
            //Added by Loveena in ref to Task#2414 on 2nd March 2009 to calculate Pharmacy on press of tab key of Qty.
            myscript += "$create(Streamline.SmartClient.UI.TextBox, {'ignoreEnterKey':true,Decimal:true}, {'onBlur':ClientMedicationTitration.ManipulateRowValues},{},$get('" + _txtQuantity.ClientID + "'));";
            //Code added by Loveena ends over here.

            DropDownList _DropDownListUnit = new DropDownList();
            _DropDownListUnit.Width = 80;
            _DropDownListUnit.Height = 20;
            if (textboxButtonValue != null && textboxButtonValue.Value == "Refill")
                _DropDownListUnit.Enabled = false;
            _DropDownListUnit.ID = "DropDownListUnit" + rowIndex;

            DropDownList _DropDownListSchedule = new DropDownList();
            _DropDownListSchedule.Width = 180;
            _DropDownListSchedule.Height = 20;
            if (textboxButtonValue != null && textboxButtonValue.Value == "Refill")
                _DropDownListSchedule.Enabled = false;
            _DropDownListSchedule.ID = "DropDownListSchedule" + rowIndex;

            DevExpress.Web.ASPxEditors.ASPxComboBox _comboBoxPharmText = new DevExpress.Web.ASPxEditors.ASPxComboBox();
            _comboBoxPharmText.ID = "_comboBoxPharmacy" + rowIndex;
            _comboBoxPharmText.Visible = true;
            _comboBoxPharmText.Enabled = true;
            _comboBoxPharmText.DropDownStyle = DevExpress.Web.ASPxEditors.DropDownStyle.DropDown;
            _comboBoxPharmText.Style["text-align"] = "Right";
            _comboBoxPharmText.ClientInstanceName = "ComboPharmaText" + rowIndex;
            _comboBoxPharmText.ClientSideEvents.KeyPress = "function(s, e) { ClientMedicationTitration.CheckKeyPress(" + rowIndex + "); }";
            _comboBoxPharmText.EnableFocusedStyle = false;
            _comboBoxPharmText.EnableTheming = false;
            _comboBoxPharmText.ItemStyle.Border.BorderStyle = BorderStyle.None;
            _comboBoxPharmText.Font.Name = "Microsoft Sans Serif";
            _comboBoxPharmText.Font.Size = new FontUnit(8.50, UnitType.Point);
            _comboBoxPharmText.Border.BorderColor = System.Drawing.ColorTranslator.FromHtml("#7b9ebd");
            _comboBoxPharmText.Height = new Unit(6, UnitType.Pixel);
            #endregion

            TextBox _txtSample = new TextBox();
            _txtSample.BackColor = System.Drawing.Color.White;
            _txtSample.MaxLength = 4;
            _txtSample.ID = "TextBoxSample" + rowIndex;
            _txtSample.Width = 40;
            _txtSample.Height = 20;
            _txtSample.Visible = true;
            _txtSample.Style["text-align"] = "Right";
            myscript += "$create(Streamline.SmartClient.UI.TextBox, {'ignoreEnterKey':true,Decimal:true}, {},{},$get('" + _txtSample.ClientID + "'));";

            TextBox _txtStock = new TextBox();
            _txtStock.BackColor = System.Drawing.Color.White;
            _txtStock.MaxLength = 4;
            _txtStock.ID = "TextBoxStock" + rowIndex;
            _txtStock.Width = 40;
            _txtStock.Height = 20;
            _txtStock.Visible = true;
            _txtStock.Style["text-align"] = "Right";
            myscript += "$create(Streamline.SmartClient.UI.TextBox, {'ignoreEnterKey':true,Decimal:true}, {},{},$get('" + _txtStock.ClientID + "'));";

            Label _RowIdentifier = new Label();
            _RowIdentifier.ID = "RowIdentifier" + rowIndex;

            //Added by Loveena in ref to Task#2802
            HiddenField _hiddenAutoCalcAllowed = new HiddenField();
            _hiddenAutoCalcAllowed.ID = "HiddenFieldAutoCalcAllowed" + rowIndex;

            _TableCell0.Controls.Add(_ImgDeleteRow);
            _TableCell1.Controls.Add(_DropDownListStrength);
            _TableCell2.Controls.Add(_txtQuantity);
            _TableCell3.Controls.Add(_DropDownListUnit);
            _TableCell4.Controls.Add(_DropDownListSchedule);
            //_TableCell5.Controls.Add(_txtPharma);
            _TableCell5.Controls.Add(_comboBoxPharmText);
            _TableCell6.Controls.Add(_txtSample);
            _TableCell7.Controls.Add(_txtStock);
            _TableCell8.Controls.Add(_RowIdentifier);
            _TableCell9.Controls.Add(_hiddenAutoCalcAllowed);

            _TableRow.Controls.Add(_TableCell0);
            _TableRow.Controls.Add(_TableCell1);
            _TableRow.Controls.Add(_TableCell2);
            _TableRow.Controls.Add(_TableCell3);
            _TableRow.Controls.Add(_TableCell4);
            _TableRow.Controls.Add(_TableCell5);
            _TableRow.Controls.Add(_TableCell6);
            _TableRow.Controls.Add(_TableCell7);
            _TableRow.Controls.Add(_TableCell8);
            _TableRow.Controls.Add(_TableCell9);

            _DropDownListStrength.Attributes.Add("onchange", "ClientMedicationTitration.onStrengthChange(this,'" + _DropDownListUnit.ClientID + "',null,'" + _txtQuantity.ClientID + "','" + rowIndex + "')");
            _DropDownListSchedule.Attributes.Add("onBlur", "ClientMedicationTitration.onScheduleBlur(this)");
            _DropDownListSchedule.Attributes.Add("onchange", "ClientMedicationTitration.onScheduleChange(" + rowIndex + ")");
            _DropDownListUnit.Attributes.Add("onchange", "ClientMedicationTitration.onUnitChange(" + rowIndex + ")");
            return _TableRow;
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
                ex.Data["CustomExceptionInformation"] = "";
            else
                ex.Data["CustomExceptionInformation"] = "";
            if (ex.Data["DatasetInfo"] == null)
                ex.Data["DatasetInfo"] = "";
            throw (ex);
        }
    }
Ejemplo n.º 45
0
        private void dlUrlMap_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int         urlID       = Convert.ToInt32(dlUrlMap.DataKeys[e.Item.ItemIndex]);
            FriendlyUrl friendlyUrl = new FriendlyUrl(urlID);

            switch (e.CommandName)
            {
            case "edit":
                dlUrlMap.EditItemIndex = e.Item.ItemIndex;
                Control      c  = e.Item.FindControl("ddPagesEdit");
                DropDownList dd = null;
                if ((c != null) && (pageList != null))
                {
                    dd            = (DropDownList)c;
                    dd.DataSource = pageList;
                    dd.DataBind();
                }
                PopulateControls();
                if (dd != null)
                {
                    String selection = ParsePageId(friendlyUrl.RealUrl);
                    if (selection.Length > 0)
                    {
                        ListItem listItem = dd.Items.FindByValue(selection);
                        if (listItem != null)
                        {
                            dd.ClearSelection();
                            listItem.Selected = true;
                        }
                    }
                }
                break;

            case "apply":

                TextBox txtItemFriendlyUrl
                    = (TextBox)e.Item.FindControl("txtItemFriendlyUrl");

                if (txtItemFriendlyUrl.Text.Length > 0)
                {
                    Control cEdit = e.Item.FindControl("ddPagesEdit");
                    if (cEdit != null)
                    {
                        DropDownList ddEdit = (DropDownList)cEdit;
                        friendlyUrl.Url = txtItemFriendlyUrl.Text;
                        if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url))
                        {
                            this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                            return;
                        }


                        int pageId = -1;
                        if (int.TryParse(ddEdit.SelectedValue, out pageId))
                        {
                            if (pageId > -1)
                            {
                                PageSettings page = new PageSettings(siteSettings.SiteId, pageId);
                                friendlyUrl.PageGuid = page.PageGuid;
                            }
                        }

                        friendlyUrl.RealUrl = "Default.aspx?pageid=" + ddEdit.SelectedValue;
                        friendlyUrl.Save();
                    }

                    WebUtils.SetupRedirect(this, Request.RawUrl);
                }
                else
                {
                    this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage;
                }
                break;

            case "applymanual":

                if (
                    (
                        (((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text.Length > 0)
                    ) &&
                    (
                        (((TextBox)e.Item.FindControl("txtItemRealUrl")).Text.Length > 0)
                    )
                    )
                {
                    friendlyUrl.Url = ((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text;
                    if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url))
                    {
                        this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                        return;
                    }
                    friendlyUrl.RealUrl  = ((TextBox)e.Item.FindControl("txtItemRealUrl")).Text;
                    friendlyUrl.PageGuid = Guid.Empty;
                    friendlyUrl.Save();
                    WebUtils.SetupRedirect(this, Request.RawUrl);
                }
                else
                {
                    this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage;
                }
                break;

            case "delete":

                FriendlyUrl.DeleteUrl(urlID);
                WebUtils.SetupRedirect(this, Request.RawUrl);
                break;

            case "cancel":
                WebUtils.SetupRedirect(this, Request.RawUrl);
                break;
            }
        }
Ejemplo n.º 46
0
        private void SaveToSP()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPSite oSite             = new SPSite(SPContext.Current.Web.Url);
                SPWeb spWeb              = oSite.OpenWeb();
                spWeb.AllowUnsafeUpdates = true;
                SPList spList            = spWeb.GetList(SPUrlUtility.CombineUrl(spWeb.ServerRelativeUrl, "lists/" + "SkillsRating"));

                #region Remove any previous Ratings of same Emp and Year, by updating "deleted" to 1

                SPQuery qry = new SPQuery();
                qry.Query   =
                    @"   <Where>
                                          <And>
                                             <Eq>
                                                <FieldRef Name='Emp' />
                                                <Value Type='User'>" + strEmpDisplayName + @"</Value>
                                             </Eq>
                                             <Eq>
                                                <FieldRef Name='ObjYear' />
                                                <Value Type='Text'>" + Active_Rate_Goals_Year + @"</Value>
                                             </Eq>
                                          </And>
                                       </Where>";
                qry.ViewFieldsOnly             = true;
                qry.ViewFields                 = @"<FieldRef Name='ID' />";
                SPListItemCollection listItems = spList.GetItems(qry);

                foreach (SPListItem item in listItems)
                {
                    SPListItem itemToUpdate = spList.GetItemById(item.ID);
                    itemToUpdate["deleted"] = 1;
                    itemToUpdate.Update();
                }

                #endregion Remove any previous Ratings of same Emp and Year, by updating "deleted" to 1

                #region Add the new Ratings

                foreach (GridViewRow row in gvw_Std_Skills.Rows)
                {
                    SPListItem oListItem = spList.AddItem();
                    oListItem["Title"]   = row.Cells[0].Text;
                    var dd = row.Cells[1].FindControl("ddl_Std_Skill_Rating") as DropDownList;
                    oListItem["Rating"]  = int.Parse(dd.SelectedValue);
                    oListItem["Emp"]     = SPContext.Current.Web.EnsureUser(intended_Emp.login_name_to_convert_to_SPUser);
                    oListItem["ObjYear"] = Active_Rate_Goals_Year;
                    oListItem.Update();
                }

                #endregion Add the new Ratings

                spWeb.AllowUnsafeUpdates = false;

                foreach (GridViewRow row in gvwRate.Rows)
                {
                    DropDownList ddlObjRating = row.FindControl("ddlObjRating") as DropDownList;
                    tblObjectives.Rows[row.RowIndex]["AccRating"] = ddlObjRating.SelectedItem.Text;
                }

                SetProgress_DAL.Update_Objectives("AccRating", tblObjectives);

                EvalNotes evalnotes           = new EvalNotes();
                evalnotes.ReasonForRating1or5 = txtNote_ReasonForRating1or5.Text;
                evalnotes.RecommendedCourses  = txtNote_RecommendedCourses.Text;

                SetProgress_DAL.Save_or_Update_Objs_EvalNotes(intended_Emp.login_name_to_convert_to_SPUser, Active_Rate_Goals_Year, evalnotes);
            });
        }
Ejemplo n.º 47
0
    protected void LI_Blocs_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            News.Bloc bloc = new News.Bloc();
            News      news = DataMapping.GetNews_EN(Request.QueryString["newsid"]);
            if (Request.QueryString["blocid"] != "" && Request.QueryString["blocid"] != null)
            {
                foreach (News.Bloc b in news.GetListBlocs())
                {
                    if (b.id == Request.QueryString["blocid"])
                    {
                        bloc = b;
                    }
                }
            }

            if (e.CommandSource == e.Item.FindControl("lbt_delete"))
            {
                LinkButton lbt_delete = (LinkButton)e.Item.FindControl("lbt_delete");
                foreach (News.Bloc b in news.GetListBlocs())
                {
                    if (b.id == lbt_delete.CommandArgument)
                    {
                        theBloc = b;
                    }
                }
                if (!DataMapping.DeleteNewsBloc(theBloc))
                {
                    throw new Exception("Error deleting");
                }

                string url = Functions.UrlAddParam(Globals.NavigateURL(), "newsid", Request.QueryString["newsid"]);

                Response.Redirect(url);
            }

            #region Type
            if (e.CommandSource == e.Item.FindControl("btn_type"))
            {
                RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("rbl_type");
                foreach (ListItem li in rbl.Items)
                {
                    if (li.Selected)
                    {
                        bloc.type = "Bloc" + li.Value;
                    }
                }
                List <News.Bloc> blocs = new List <News.Bloc>();
                blocs.Add(bloc);
                LI_Blocs.DataSource = blocs;
                LI_Blocs.DataBind();
            }
            #endregion Type

            #region Validate
            if (e.CommandSource == e.Item.FindControl("btn_validate"))
            {
                Button btn = (Button)e.Item.FindControl("btn_validate");


                TextBox tbx_title = (TextBox)e.Item.FindControl("tbx_titre");
                if (tbx_title.Text != null)
                {
                    bloc.title = tbx_title.Text;
                }
                else
                {
                    bloc.title = "";
                }
                Panel pnl_links = (Panel)e.Item.FindControl("pnl_links");
                Panel pnl_files = (Panel)e.Item.FindControl("pnl_files");
                Panel pnl_video = (Panel)e.Item.FindControl("pnl_video");

                #region General
                if (!pnl_links.Visible && !pnl_files.Visible && !pnl_video.Visible)
                {
                    TextBox tbx_content = (TextBox)e.Item.FindControl("tbx_contenu");
                    if (tbx_content.Text != null && tbx_content.Visible)
                    {
                        bloc.content = tbx_content.Text;
                    }
                    else
                    {
                        bloc.content = "";
                    }

                    Image img = (Image)e.Item.FindControl("Image2");
                    if (img.ImageUrl != null && img.Visible)
                    {
                        bloc.photo = img.ImageUrl;
                    }
                    else
                    {
                        bloc.photo = "";
                    }

                    if (bloc.content_type == null || bloc.content_type == "")
                    {
                        bloc.content_type = "text";
                    }
                }
                #endregion General

                #region Links
                else if (pnl_links.Visible)
                {
                    TextBox tbx_link1 = (TextBox)e.Item.FindControl("tbx_link1");
                    TextBox tbx_link2 = (TextBox)e.Item.FindControl("tbx_link2");
                    TextBox tbx_link3 = (TextBox)e.Item.FindControl("tbx_link3");
                    TextBox tbx_link4 = (TextBox)e.Item.FindControl("tbx_link4");

                    TextBox tbx_text1 = (TextBox)e.Item.FindControl("tbx_text1");
                    TextBox tbx_text2 = (TextBox)e.Item.FindControl("tbx_text2");
                    TextBox tbx_text3 = (TextBox)e.Item.FindControl("tbx_text3");
                    TextBox tbx_text4 = (TextBox)e.Item.FindControl("tbx_text4");

                    DropDownList ddl_target1 = (DropDownList)e.Item.FindControl("ddl_target1");
                    DropDownList ddl_target2 = (DropDownList)e.Item.FindControl("ddl_target2");
                    DropDownList ddl_target3 = (DropDownList)e.Item.FindControl("ddl_target3");
                    DropDownList ddl_target4 = (DropDownList)e.Item.FindControl("ddl_target4");

                    List <Link> links = new List <Link>();


                    if (tbx_link1.Text != "")
                    {
                        Link link1 = new Link();
                        link1.Url    = tbx_link1.Text;
                        link1.Texte  = tbx_text1.Text;
                        link1.Target = (ddl_target1.SelectedIndex == 1 ? "_blank" : "");
                        links.Add(link1);
                    }
                    if (tbx_link2.Text != "")
                    {
                        Link link2 = new Link();
                        link2.Url    = tbx_link2.Text;
                        link2.Texte  = tbx_text2.Text;
                        link2.Target = (ddl_target2.SelectedIndex == 1 ? "_blank" : "");
                        links.Add(link2);
                    }
                    if (tbx_link3.Text != "")
                    {
                        Link link3 = new Link();
                        link3.Url    = tbx_link3.Text;
                        link3.Texte  = tbx_text3.Text;
                        link3.Target = (ddl_target3.SelectedIndex == 1 ? "_blank" : "");
                        links.Add(link3);
                    }
                    if (tbx_link4.Text != "")
                    {
                        Link link4 = new Link();
                        link4.Url    = tbx_link4.Text;
                        link4.Texte  = tbx_text4.Text;
                        link4.Target = (ddl_target4.SelectedIndex == 1 ? "_blank" : "");
                        links.Add(link4);
                    }

                    bloc.content      = Functions.Serialize(links);
                    bloc.content_type = "links";
                    bloc.photo        = "";
                }
                #endregion Links

                #region Video
                else if (pnl_video.Visible)
                {
                    TextBox tbx_urlYT = (TextBox)e.Item.FindControl("tbx_urlYT");
                    Video   video     = new Video();
                    video.Url = tbx_urlYT.Text;
                    if (video.Url.Contains("youtube"))
                    {
                        video.Type = "youtube";
                    }
                    else if (video.Url.Contains("vimeo"))
                    {
                        video.Type = "vimeo";
                    }
                    else
                    {
                        video.Type = "daily";
                    }
                    bloc.content      = Functions.Serialize(video);
                    bloc.photo        = "";
                    bloc.content_type = "video/" + video.Type;
                }
                #endregion Video

                #region Files
                else
                {
                    List <AIS_File> files = new List <AIS_File>();

                    if (bloc.content != null && bloc.content != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(bloc.content, files.GetType());
                    }

                    if (hfd_files.Value != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(hfd_files.Value, files.GetType());
                    }

                    hfd_filesToDelete.Value = "";



                    bloc.content      = Functions.Serialize(files);
                    bloc.photo        = "";
                    bloc.content_type = "files";
                }
                #endregion Files

                bloc.visible = "O";
                RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("rbl_type");
                foreach (ListItem li in rbl.Items)
                {
                    if (li.Selected)
                    {
                        bloc.type = "Bloc" + li.Value;
                    }
                }
                if (bloc.ord == 0)
                {
                    bloc.ord = (news.GetListBlocs().Count + 1) * 10;
                }

                if (!DataMapping.UpdateNewsBloc(bloc, Request.QueryString["newsid"]))
                {
                    throw new Exception("Error during update");
                }

                string url = Functions.UrlAddParam(Globals.NavigateURL(), "newsid", Request.QueryString["newsid"]);

                Response.Redirect(url);
            }
            #endregion Validate

            #region Upload Image
            if (e.CommandSource == e.Item.FindControl("btn_upload"))
            {
                FileUpload ful = (FileUpload)e.Item.FindControl("ful_img");
                if (ful.HasFile)
                {
                    ///////////////////////////////////////////////////////*Changer ici l'image*//////////////////////////////////
                    string fileName = Path.GetFileName(Guid.NewGuid().ToString() + "-" + ful.PostedFile.FileName);
                    string path     = PortalSettings.HomeDirectory + accessPath + "/" + news.tag1 + "/Images/2015-2016/";
                    if (accessPath == "")
                    {
                        path = PortalSettings.HomeDirectory + "District/Courrier du District/" + news.tag1 + "/Images/2015-2016/";
                    }
                    DirectoryInfo d = new DirectoryInfo(Server.MapPath(path));
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                    ful.PostedFile.SaveAs(Server.MapPath(path) + fileName);

                    TextBox tbx_title = (TextBox)e.Item.FindControl("tbx_titre");
                    if (tbx_title.Text != null)
                    {
                        bloc.title = tbx_title.Text;
                    }
                    else
                    {
                        bloc.title = "";
                    }

                    TextBox tbx_content = (TextBox)e.Item.FindControl("tbx_contenu");
                    if (tbx_content.Text != null)
                    {
                        bloc.content = tbx_content.Text;
                    }
                    else
                    {
                        bloc.content = "";
                    }

                    RadioButtonList rbl_type = (RadioButtonList)e.Item.FindControl("rbl_type");
                    foreach (ListItem li in rbl_type.Items)
                    {
                        if (li.Selected)
                        {
                            bloc.type = "Bloc" + li.Value;
                        }
                    }

                    bloc.photo = path + fileName;
                    List <News.Bloc> blocs = new List <News.Bloc>();
                    blocs.Add(bloc);
                    LI_Blocs.DataSource = blocs;
                    LI_Blocs.DataBind();
                    Button btn_upload = (Button)e.Item.FindControl("btn_upload");
                    btn_upload.Text = "Changer l'image";
                }
            }
            #endregion Upload Image

            #region Upload Files
            if (e.CommandSource == e.Item.FindControl("btn_uploadFiles"))
            {
                FileUpload ful = (FileUpload)e.Item.FindControl("ful_files");
                if (ful.HasFile)
                {
                    string fileName = Path.GetFileName(Guid.NewGuid().ToString() + "-" + ful.PostedFile.FileName);
                    string path     = PortalSettings.HomeDirectory + accessPath + "/" + news.tag1 + "/Documents/2015-2016/";
                    if (accessPath == "")
                    {
                        path = PortalSettings.HomeDirectory + "District/Courrier du District/" + news.tag1 + "/Documents/2015-2016/";
                    }
                    DirectoryInfo d = new DirectoryInfo(Server.MapPath(path));
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                    ful.PostedFile.SaveAs(Server.MapPath(path) + fileName);

                    TextBox tbx_title = (TextBox)e.Item.FindControl("tbx_titre");
                    if (tbx_title.Text != null)
                    {
                        bloc.title = tbx_title.Text;
                    }
                    else
                    {
                        bloc.title = "";
                    }



                    RadioButtonList rbl_type = (RadioButtonList)e.Item.FindControl("rbl_type");
                    foreach (ListItem li in rbl_type.Items)
                    {
                        if (li.Selected)
                        {
                            bloc.type = "Bloc" + li.Value;
                        }
                    }

                    bloc.visible = "O";

                    List <AIS_File> files = new List <AIS_File>();

                    if (bloc.content != null && bloc.content != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(bloc.content, files.GetType());
                    }
                    else if (Request.QueryString["add"] != null && Request.QueryString["add"] != "" && Request.QueryString["add"] == "true")
                    {
                        files = hfd_filesToDelete.Value == "" ? new List <AIS_File>() : (List <AIS_File>)Functions.Deserialize(hfd_filesToDelete.Value, files.GetType());
                    }
                    AIS_File file = new AIS_File();
                    file.Name = ful.PostedFile.FileName;
                    file.Url  = path + fileName;

                    files.Add(file);
                    bloc.content      = Functions.Serialize(files);
                    bloc.content_type = "files";
                    bloc.photo        = "";
                    hfd_files.Value   = Functions.Serialize(files);

                    List <AIS_File> filesToDelete = new List <AIS_File>();
                    if (hfd_filesToDelete.Value != "")
                    {
                        filesToDelete = (List <AIS_File>)Functions.Deserialize(hfd_filesToDelete.Value, files.GetType());
                    }
                    filesToDelete.Add(file);
                    hfd_filesToDelete.Value = Functions.Serialize(filesToDelete);


                    List <News.Bloc> blocs = new List <News.Bloc>();
                    blocs.Add(bloc);
                    if (bloc.id != null && Request.QueryString["newsid"] != null && Request.QueryString["newsid"] != "")
                    {
                        if (!DataMapping.UpdateNewsBloc(bloc, Request.QueryString["newsid"]))
                        {
                            throw new Exception("Error during update");
                        }
                    }



                    LI_Blocs.DataSource = blocs;
                    LI_Blocs.DataBind();

                    /*blocs = DataMapping.GetNews_EN(news.id).GetListBlocs();
                     *
                     * foreach(News.Bloc b in blocs)
                     * {
                     *  if (b.content == bloc.content)
                     *      bloc = b;
                     * }
                     * String url = Functions.UrlAddParam(Globals.NavigateURL(), "newsid", news.id);
                     * url = Functions.UrlAddParam(Globals.NavigateURL(), "blocid", bloc.id);
                     * if(Request.QueryString["add"]!= null && Request.QueryString["add"]!="" && Request.QueryString["add"] =="true")
                     *  url = Functions.UrlAddParam(Globals.NavigateURL(), "add", "true");
                     * else if (Request.QueryString["edit"] != null && Request.QueryString["edit"] != "" && Request.QueryString["edit"] == "true")
                     *  url = Functions.UrlAddParam(Globals.NavigateURL(), "edit", "true");
                     *
                     * Response.Redirect(url);*/
                }
            }
            #endregion Upload Files

            #region Up/Down
            if (e.CommandSource == e.Item.FindControl("ibt_up"))
            {
                foreach (News.Bloc b in news.GetListBlocs())
                {
                    if (b.id == e.CommandName)
                    {
                        bloc = b;
                    }
                }
                if (bloc.ord > 10)
                {
                    News.Bloc blocOnTop = null;
                    foreach (News.Bloc b in news.GetListBlocs())
                    {
                        if (b.ord == bloc.ord - 10)
                        {
                            blocOnTop = b;
                        }
                    }
                    if (blocOnTop == null)
                    {
                        throw new Exception("Error bloc on top");
                    }
                    int tempOrd = bloc.ord;
                    bloc.ord      = blocOnTop.ord;
                    blocOnTop.ord = tempOrd;


                    if (!DataMapping.UpdateNewsBloc(bloc))
                    {
                        throw new Exception("Error update bloc");
                    }
                    if (!DataMapping.UpdateNewsBloc(blocOnTop))
                    {
                        throw new Exception("Error update bloc on top");
                    }
                }
                news = DataMapping.GetNews_EN(Request.QueryString["newsid"]);
                LI_Blocs.DataSource = news.GetListBlocs();
                LI_Blocs.DataBind();
            }
            if (e.CommandSource == e.Item.FindControl("ibt_down"))
            {
                foreach (News.Bloc b in news.GetListBlocs())
                {
                    if (b.id == e.CommandName)
                    {
                        bloc = b;
                    }
                }
                if (bloc.ord < 10 * (news.GetListBlocs().Count))
                {
                    News.Bloc blocOnBot = null;
                    foreach (News.Bloc b in news.GetListBlocs())
                    {
                        if (b.ord == bloc.ord + 10)
                        {
                            blocOnBot = b;
                        }
                    }
                    if (blocOnBot == null)
                    {
                        throw new Exception("Error bloc on top");
                    }
                    int tempOrd = bloc.ord;
                    bloc.ord      = blocOnBot.ord;
                    blocOnBot.ord = tempOrd;


                    if (!DataMapping.UpdateNewsBloc(bloc))
                    {
                        throw new Exception("Error update bloc");
                    }
                    if (!DataMapping.UpdateNewsBloc(blocOnBot))
                    {
                        throw new Exception("Error update bloc on bottom");
                    }
                }
                news = DataMapping.GetNews_EN(Request.QueryString["newsid"]);
                LI_Blocs.DataSource = news.GetListBlocs();
                LI_Blocs.DataBind();
            }
            #endregion Up/Down

            #region cancel
            if (e.CommandSource == e.Item.FindControl("btn_cancel"))
            {
                if (bloc.content != "" && bloc.type == "BlocFiles")
                {
                    List <AIS_File> files = new List <AIS_File>();

                    if (bloc.content != null && bloc.content != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(bloc.content, files.GetType());
                    }

                    if (hfd_files.Value != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(hfd_files.Value, files.GetType());
                    }

                    List <AIS_File> filesToDelete = new List <AIS_File>();

                    if (hfd_filesToDelete.Value != "")
                    {
                        filesToDelete = (List <AIS_File>)Functions.Deserialize(hfd_filesToDelete.Value, filesToDelete.GetType());
                        if (filesToDelete.Count == 0)
                        {
                            throw new Exception("Zero files");
                        }
                        foreach (AIS_File fi in files)
                        {
                            bool breaker = false;
                            foreach (AIS_File f in filesToDelete)
                            {
                                if (fi.Url == f.Url)
                                {
                                    files.Remove(fi);
                                    breaker = true;
                                    break;
                                }
                            }
                            if (breaker)
                            {
                                break;
                            }
                        }
                    }



                    bloc.content      = Functions.Serialize(files);
                    bloc.photo        = "";
                    bloc.content_type = "files";


                    bloc.visible = "O";
                    RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("rbl_type");
                    foreach (ListItem li in rbl.Items)
                    {
                        if (li.Selected)
                        {
                            bloc.type = "Bloc" + li.Value;
                        }
                    }
                    if (bloc.ord == 0)
                    {
                        bloc.ord = (news.GetListBlocs().Count + 1) * 10;
                    }

                    if (!DataMapping.UpdateNewsBloc(bloc, Request.QueryString["newsid"]))
                    {
                        throw new Exception("Error during update");
                    }
                }


                String url = Functions.UrlAddParam(Globals.NavigateURL(), "newsid", Request.QueryString["newsid"]);
                Response.Redirect(url);
            }

            #endregion cancel
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
        }
    }
Ejemplo n.º 48
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //string strWorkExp = "<WorkExpList>";
        //if (gdWorkExp.Rows.Count > 0)
        //{


        try
        {
            Upload();

            DataSet ds = new DataSet();
            ds = null;
            objDAEntities.FunctionId                 = Convert.ToInt32(lblFunctionID.Text);
            objDAEntities.PositionID                 = Convert.ToInt32(lblJobId.Text);
            objDAEntities.ApplicantFirstName         = txtFirstName.Text.Trim();
            objDAEntities.ApplicantMiddleName        = txtMiddleName.Text;
            objDAEntities.ApplicantLastName          = txtLastName.Text;
            objDAEntities.ApplicantDOB               = Convert.ToDateTime(rdpDOB.SelectedDate).ToShortDateString().ToString();
            objDAEntities.ApplicantGender            = ddlGender.SelectedValue;
            objDAEntities.ApplicantReligion          = txtReligion.Text;
            objDAEntities.ApplicantNationality       = ddlNationality.SelectedValue;
            objDAEntities.ApplicantLandLineOffice    = txtLandLineOffice1.Text.Trim() + "-" + txtLandLineOffice2.Text.Trim();
            objDAEntities.ApplicantLandLineResidance = txtLandLineRes1.Text.Trim() + "-" + txtLandLineRes2.Text.Trim();

            objDAEntities.ApplicantMobile           = txtMobile.Text;
            objDAEntities.ApplicantEmail            = txtEmail.Text;
            objDAEntities.ApplicantCurrentAddress   = txtCurrentAddress.Text;
            objDAEntities.ApplicantPermanentAddress = txtPermanentAddress.Text;
            objDAEntities.AdditionalQualification   = txtAddotionalQual.Text;

            objDAEntities.TotalExpInYear = DBNull.Value;
            if (ddlTotalExp.SelectedValue != "")
            {
                objDAEntities.TotalExpInYear = Convert.ToInt32(ddlTotalExp.SelectedValue);
            }

            objDAEntities.TotalExpInMonth = DBNull.Value;
            if (ddlTotalExpMonth.SelectedValue != "")
            {
                objDAEntities.TotalExpInMonth = Convert.ToInt32(ddlTotalExpMonth.SelectedValue);
            }

            objDAEntities.AdditionalExpInYear = DBNull.Value;
            if (ddlOtherExp.SelectedValue != "")
            {
                objDAEntities.AdditionalExpInYear = Convert.ToInt32(ddlOtherExp.SelectedValue);
            }

            objDAEntities.AdditionalExpInMonth = DBNull.Value;
            if (ddlOtherExpMonth.SelectedValue != "")
            {
                objDAEntities.AdditionalExpInMonth = Convert.ToInt32(ddlOtherExpMonth.SelectedValue);
            }

            objDAEntities.ApplicantCurrSal = DBNull.Value;
            if (txtCurrSal.Text != "")
            {
                objDAEntities.ApplicantCurrSal = Convert.ToDouble(txtCurrSal.Text);
            }
            objDAEntities.ApplicantExpSal = DBNull.Value;
            if (txtExpSal.Text != "")
            {
                objDAEntities.ApplicantExpSal = Convert.ToDouble(txtExpSal.Text);
            }

            objDAEntities.ApplicantCVPath = ViewState["FilePath"].ToString();


            objDAEntities.ApplicantID = objBusinessLogic.SaveCandidateApplication(objDAEntities);

            if (objDAEntities.ApplicantID > 0)
            {
                DataTable dt = new DataTable();
                dt = getWorkExpTable();

                // Add Work Experience
                for (int i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    if (dt.Rows[i]["CompanyName"] != null)
                    {
                        DataSet dsnew = new DataSet();
                        dsnew = null;

                        objDAEntities.ApplicantID     = objDAEntities.ApplicantID;
                        objDAEntities.CompanyName     = Convert.ToString(dt.Rows[i]["CompanyName"]);
                        objDAEntities.empDesignation  = Convert.ToString(dt.Rows[i]["empDesignation"]);
                        objDAEntities.CompanyTurnOver = Convert.ToString(dt.Rows[i]["CompanyTurnOver"]);
                        if (!string.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["NoOfEmployee"])))
                        {
                            objDAEntities.NoOfEmployee = Convert.ToInt32(dt.Rows[i]["NoOfEmployee"]);
                        }
                        objDAEntities.JobResponsibilities = Convert.ToString(dt.Rows[i]["JobResponsibilities"]);
                        objDAEntities.Location            = Convert.ToString(dt.Rows[i]["Location"].ToString());
                        objDAEntities.FromDate            = Convert.ToString(dt.Rows[i]["FromDate"]);
                        objDAEntities.ToDate    = Convert.ToString(dt.Rows[i]["ToDate"]);
                        objDAEntities.Reporting = Convert.ToString(dt.Rows[i]["Reporting"]);
                        if (!string.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SalaryInlacs"])))
                        {
                            objDAEntities.SalaryInlacs = Convert.ToDouble(dt.Rows[i]["SalaryInlacs"]);
                        }
                        // objDAEntities.SalaryInlacs =(!string.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["SalaryInlacs"])))?Convert.ToDouble(dt.Rows[i]["SalaryInlacs"]):;
                        objDAEntities.ReasonForLeaving = Convert.ToString(dt.Rows[i]["ReasonForLeaving"]);

                        string msg = objBusinessLogic.SaveWorkExpByApplicant(objDAEntities);
                    }
                }



                // Add Qualification

                for (int i = 1; i <= 5; i++)
                {
                    string       ddlName   = "ddlQualification" + i.ToString();
                    DropDownList ddlQualID = (DropDownList)this.FindControl(ddlName);
                    //ddlQualID.ID = ddlName;


                    if (ddlQualID.SelectedValue != "")
                    {
                        if (Convert.ToInt32(ddlQualID.SelectedValue) > 0)
                        {
                            string  strDegree = "txtDegree" + i.ToString();
                            TextBox txtDegree = (TextBox)this.FindControl(strDegree);

                            string  strUniversity = "txtUniversity" + i.ToString();
                            TextBox txtUniversity = (TextBox)this.FindControl(strUniversity);

                            string  strSpecialization = "txtSpecialization" + i.ToString();
                            TextBox txtSpecialization = (TextBox)this.FindControl(strSpecialization);

                            string  strGrade = "txtGrade" + i.ToString();
                            TextBox txtGrade = (TextBox)this.FindControl(strGrade);


                            objDAEntities.ApplicantID         = objDAEntities.ApplicantID;
                            objDAEntities.AppQualification    = ddlQualID.SelectedItem.Text;
                            objDAEntities.AppDegree           = txtDegree.Text;
                            objDAEntities.AppUniversityName   = txtUniversity.Text;
                            objDAEntities.AppSpecialization   = txtSpecialization.Text;
                            objDAEntities.AppPercentage_Grade = txtGrade.Text;

                            string msg = objBusinessLogic.Save_ApplicantQualification(objDAEntities);
                        }
                    }
                }
            }

            JaslokMailer      objMailer     = new JaslokMailer();
            List <Parameters> lstParameters = new List <Parameters>();
            lstParameters.Add(new Parameters {
                ShortCodeName = "Post", ShortCodeValue = txtPost.Text.Trim()
            });
            lstParameters.Add(new Parameters {
                ShortCodeName = "Username", ShortCodeValue = txtFirstName.Text.Trim() + " " + (!string.IsNullOrEmpty(txtMiddleName.Text.Trim()) ? (txtMiddleName.Text.Trim() + " ") : string.Empty) + txtLastName.Text.Trim()
            });
            lstParameters.Add(new Parameters {
                ShortCodeName = "DateOfBirth", ShortCodeValue = Convert.ToDateTime(rdpDOB.SelectedDate).ToString("dd/MM/yyyy")
            });
            lstParameters.Add(new Parameters {
                ShortCodeName = "Gender", ShortCodeValue = ddlGender.SelectedValue
            });
            lstParameters.Add(new Parameters {
                ShortCodeName = "EmailAdd", ShortCodeValue = txtEmail.Text.Trim()
            });
            lstParameters.Add(new Parameters {
                ShortCodeName = "Permanent", ShortCodeValue = txtPermanentAddress.Text.Trim()
            });

            DataSet objds = new DataSet();
            objds = null;
            objds = (DataSet)objBusinessLogic.GetFormsEmailDetail((int)AppGlobal.JaslokEmailHandler.ApplyJaslokCareer);

            string EmailToId = Convert.ToString(objds.Tables[0].Rows[0]["EmailToId"]);
            string EmailCCId = Convert.ToString(objds.Tables[0].Rows[0]["EmailCCId"]);

            objMailer.SendEmail("career", lstParameters, EmailToId, EmailCCId);

            //objMailer.SendEmail("career", lstParameters, AppGlobal.CareerEmailAddress);
            lblMessage.CssClass = "successlbl";
            lblMessage.Text     = "Application saved successfully!!!";

            clear();
        }
        catch (Exception ex)
        {
            lblMessage.CssClass = "errorlbl";
            lblMessage.Text     = ex.Message;
        }
        finally
        {
            ViewState["WorkExpData"] = null;
        }
    }
Ejemplo n.º 49
0
    protected void LI_Blocs_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            News      news = DataMapping.GetNews_EN(Request.QueryString["newsid"]);
            News.Bloc bloc = (News.Bloc)e.Item.DataItem;

            string add = "" + Request.QueryString["add"];
            if (bloc == null)
            {
                return;
            }
            if (Request.QueryString["nbfiles"] != "" && Request.QueryString["nbfiles"] != null)
            {
                bloc.type = "BlocFiles";
            }



            var panel = e.Item.FindControl("Panel1") as Panel;
            panel.CssClass = panel.CssClass + " " + bloc.type + " " + style;
            Panel pnl_content = (Panel)e.Item.FindControl("pnl_content");
            if (bloc.type.Contains("Video"))
            {
                pnl_content.CssClass += " videoContainer";
            }

            var image = e.Item.FindControl("Image1") as Image;
            image.ImageUrl = bloc.photo;
            image.Visible  = image.ImageUrl != "" && image.ImageUrl != Const.no_image;

            HyperLink hlk = (HyperLink)e.Item.FindControl("hlk_modif");
            hlk.NavigateUrl = Functions.UrlAddParam(Globals.NavigateURL(), "edit", "true");
            hlk.NavigateUrl = Functions.UrlAddParam(hlk.NavigateUrl, "newsid", Request.QueryString["newsid"]);
            hlk.NavigateUrl = Functions.UrlAddParam(hlk.NavigateUrl, "blocid", bloc.id);



            HiddenField hfd_blocid = (HiddenField)e.Item.FindControl("hfd_blocid");
            hfd_blocid.Value = bloc.id;


            LinkButton ibt_up   = (LinkButton)e.Item.FindControl("ibt_up");
            LinkButton ibt_down = (LinkButton)e.Item.FindControl("ibt_down");
            if (HasPermission())
            {
                Panel pnl = (Panel)e.Item.FindControl("pnl_modif");
                pnl.Visible = true;


                ibt_up.Visible = bloc.ord > 10 && (Request.QueryString["edit"] == "" || Request.QueryString["edit"] == null) && (Request.QueryString["add"] == "" || Request.QueryString["add"] == null) && (Request.QueryString["delete"] == "" || Request.QueryString["delete"] == null);

                ibt_down.Visible = bloc.ord < 10 * (news.GetListBlocs().Count) && (Request.QueryString["edit"] == "" || Request.QueryString["edit"] == null) && (Request.QueryString["add"] == "" || Request.QueryString["add"] == null) && (Request.QueryString["delete"] == "" || Request.QueryString["delete"] == null);
            }

            var             image2   = e.Item.FindControl("Image2") as Image;
            TextBox         tbx      = (TextBox)e.Item.FindControl("tbx_contenu");
            RadioButtonList rbl_type = (RadioButtonList)e.Item.FindControl("rbl_type");

            foreach (ListItem li in rbl_type.Items)
            {
                if ("Bloc" + li.Value == bloc.type)
                {
                    li.Selected = true;
                }
            }

            image2.ImageUrl = bloc.photo;
            image2.Visible  = image2.ImageUrl != "" && image2.ImageUrl != Const.no_image;

            string edit = ("" + Request.QueryString["edit"]);

            var Panel2 = e.Item.FindControl("Panel2") as Panel;
            if (edit == "true" || add == "true")
            {
                panel.Visible  = false;
                Panel2.Visible = true;
                hlk.Visible    = false;
            }
            string supp = ("" + Request.QueryString["delete"]);
            if (supp == "true")
            {
                pnl_delete.Visible = true;
                hlk.Visible        = false;
            }

            int cric = Functions.CurrentCric;



            Label      contenu    = (Label)e.Item.FindControl("lbl_contenu");
            Label      lbl_img    = (Label)e.Item.FindControl("lbl_img");
            FileUpload ful        = (FileUpload)e.Item.FindControl("ful_img");
            Button     btn_upload = (Button)e.Item.FindControl("btn_upload");
            Panel      pnl_links  = (Panel)e.Item.FindControl("pnl_links");
            Panel      pnl_files  = (Panel)e.Item.FindControl("pnl_files");
            Panel      pnl_video  = (Panel)e.Item.FindControl("pnl_video");



            switch (bloc.type)
            {
            case "BlocNoPhoto":
                lbl_img.Visible    = false;
                contenu.Visible    = true;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = true;
                break;

            case "BlocPhoto":
                lbl_img.Visible    = true;
                contenu.Visible    = false;
                ful.Visible        = true;
                btn_upload.Visible = true;
                tbx.Visible        = false;
                image2.Visible     = true;
                break;

            case "BlocLinks":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_links.Visible  = true;
                break;

            case "BlocFiles":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_files.Visible  = true;
                break;

            case "BlocVideo":
                lbl_img.Visible    = false;
                contenu.Visible    = false;
                ful.Visible        = false;
                btn_upload.Visible = false;
                image2.Visible     = false;
                tbx.Visible        = false;
                pnl_video.Visible  = true;
                break;

            default:
                lbl_img.Visible    = true;
                contenu.Visible    = true;
                ful.Visible        = true;
                btn_upload.Visible = true;
                image2.Visible     = true;
                tbx.Visible        = true;
                break;
            }



            DropDownList ddl_target1 = (DropDownList)e.Item.FindControl("ddl_target1");
            DropDownList ddl_target2 = (DropDownList)e.Item.FindControl("ddl_target2");
            DropDownList ddl_target3 = (DropDownList)e.Item.FindControl("ddl_target3");
            DropDownList ddl_target4 = (DropDownList)e.Item.FindControl("ddl_target4");

            BindDDL(ddl_target1);
            BindDDL(ddl_target2);
            BindDDL(ddl_target3);
            BindDDL(ddl_target4);



            if (bloc.type == "BlocVideo" && bloc.content != null)
            {
                Label Texte1 = (Label)e.Item.FindControl("Texte1");
                Video video  = new Video();
                video       = (Video)Functions.Deserialize(bloc.content, video.GetType());
                Texte1.Text = video.getLink();
                TextBox tbx_urlYT = (TextBox)e.Item.FindControl("tbx_urlYT");
                tbx_urlYT.Text = video.Url;
            }

            if (bloc.type == "BlocLinks" && bloc.content != null)
            {
                Label       Texte1 = (Label)e.Item.FindControl("Texte1");
                List <Link> links  = new List <Link>();
                links       = (List <Link>)Functions.Deserialize(bloc.content, links.GetType());
                Texte1.Text = createListLinks(links);
                for (int i = 0; i < links.Count; i++)
                {
                    TextBox tbx_link = (TextBox)e.Item.FindControl("tbx_link" + (i + 1));
                    tbx_link.Text = links.ElementAt(i).Url;
                    DropDownList ddl = (DropDownList)e.Item.FindControl("ddl_target" + (i + 1));
                    ddl.SelectedIndex = links.ElementAt(i).Target == "" ? 0 : 1;
                    TextBox tbx_texte = (TextBox)e.Item.FindControl("tbx_text" + (i + 1));
                    tbx_texte.Text = links.ElementAt(i).Texte;
                }
            }
            if (bloc.type == "BlocFiles" && bloc.content != null)
            {
                try
                {
                    Label           Texte1 = (Label)e.Item.FindControl("Texte1");
                    List <AIS_File> files  = new List <AIS_File>();
                    if (bloc.content != null && bloc.content != "")
                    {
                        files = (List <AIS_File>)Functions.Deserialize(bloc.content, files.GetType());
                    }

                    //if (hfd_files.Value != "")
                    //    files = (List<AIS_File>) Functions.Deserialize(hfd_files.Value, files.GetType());



                    Panel pnl_filesUploaded = (Panel)e.Item.FindControl("pnl_filesUploaded");


                    #region Edit mode

                    if (files.Count > 0)
                    {
                        if (hfd_files.Value == "")
                        {
                            hfd_files.Value = bloc.content;
                        }
                        GridView gvw_filesUploaded = (GridView)e.Item.FindControl("gvw_filesUploaded");
                        gvw_filesUploaded.DataSource = files;
                        gvw_filesUploaded.DataBind();
                    }



                    #endregion Edit mode

                    #region Display mode

                    Texte1.Text = createListFile(files);

                    #endregion Display mode



                    btn_upload.Text = "Changer l'image";
                }
                catch (Exception ee)
                {
                    Functions.Error(ee);
                }
            }

            LinkButton lbt_delete = (LinkButton)e.Item.FindControl("lbt_delete");
            lbt_delete.CommandArgument = bloc.id;

            String  Stringscript = "<script> CKEDITOR.replace('" + tbx.ClientID + "', { uiColor: '#CCEAEE'});</script> ";
            Literal script       = (Literal)e.Item.FindControl("script");
            script.Text = Stringscript;
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
        }
    }
Ejemplo n.º 50
0
 private void BindDDL(DropDownList ddl)
 {
     ddl.Items.Add("Même page");
     ddl.Items.Add("Nouvelle page");
 }
Ejemplo n.º 51
0
        protected void dgExpense_ItemCreated1(object sender, DataGridItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) ||
                (e.Item.ItemType == ListItemType.AlternatingItem) ||
                (e.Item.ItemType == ListItemType.SelectedItem))
            {
                if ((e.Item.ItemType == ListItemType.Item) ||
                    (e.Item.ItemType == ListItemType.AlternatingItem) ||
                    (e.Item.ItemType == ListItemType.SelectedItem))
                {
                    try
                    {
                        int indx = e.Item.ItemIndex;
                        DataTable tbl = (DataTable)dgExpense.DataSource;
                        string strindex = tbl.Rows[indx]["record_id"].ToString();
                        ViewState["est_" + strindex] = tbl.Rows[indx]["amount"].ToString();

                        // create drop down
                        DropDownList ddl = new DropDownList();
                        ddl.CssClass = "fontsmall";
                        ddl.Width = System.Web.UI.WebControls.Unit.Pixel(75);
                        ddl.ID = "ddl_" + strindex;
                        ListItem li = new ListItem("View", "0");
                        ddl.Items.Add(li);
                        // create button
                        Button btn2 = new Button();
                        btn2.CssClass = "actbtn_go_next_button";
                        btn2.ID = "btn_" + strindex;
                        btn2.Text = "Go";
                        btn2.CausesValidation = false;
                        btn2.Click += new System.EventHandler(this.btnMenu_Click);
                        TableCell cell = e.Item.Cells[8];
                        cell.Controls.Add(ddl);
                        cell.Controls.Add(btn2);

                        TextBox txtapp = new TextBox();
                        txtapp.ID = "txt_app_" + strindex;
                        txtapp.Text = tbl.Rows[indx]["approved_amount"].ToString();
                        txtapp.CssClass = "fontsmall";
                        txtapp.Width = System.Web.UI.WebControls.Unit.Pixel(50);



                        TableCell cellApp = e.Item.Cells[2];
                        cellApp.Controls.Add(txtapp);
                        //						cellApp.Controls.Add(btn3);		

                        Button btn3 = new Button();
                        btn3.CssClass = "act_savenext_button";
                        btn3.ID = "cpy_" + strindex;
                        btn3.Text = "";
                        btn3.Width = System.Web.UI.WebControls.Unit.Pixel(20);
                        btn3.CausesValidation = false;
                        btn3.ToolTip = "Copy To Approved Amount";
                        btn3.Click += new System.EventHandler(this.btnMenu_Click);

                        Label lbl = new Label();
                        lbl.ID = "lbl_" + strindex;
                        double dbl = Convert.ToDouble(tbl.Rows[indx]["amount"].ToString());
                        lbl.Text = dbl.ToString("$#,##0.00") + "  ";
                        lbl.CssClass = "fontsmall";
                        TableCell cellApp1 = e.Item.Cells[1];
                        cellApp1.Controls.Add(lbl);
                        if (ViewState["inEdit"].ToString() == "T")
                            cellApp1.Controls.Add(btn3);
                    }
                    catch
                    {
                    }
                }
            }
        }
Ejemplo n.º 52
0
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                string   OCODE       = ((SessionUser)Session["SessionUser"]).OCode;
                DateTime EDIT_DATE   = DateTime.Now;
                Guid     userId      = ((SessionUser)Session["SessionUser"]).UserId;
                DateTime workingDate = Convert.ToDateTime(txtDate.Text);
                string   Attdate     = Convert.ToString(txtDate.Text);

                List <HRM_OfficialDay_Individual> lstHRM_OfficialDay_Individual = new List <HRM_OfficialDay_Individual>();

                if (ckIndividualWorkingDay.Checked) // individual working day type change
                {
                    if (txtbxEID.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter E-ID!')", true);
                        return;
                    }
                    if (txtDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Working Date!')", true);
                        return;
                    }
                    if (ddlworkingType.SelectedItem.Text == "------ Select One ------")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Working Day!')", true);
                        return;
                    }

                    HRM_OfficialDay_Individual aHRM_OfficialDay_Individual = new HRM_OfficialDay_Individual();

                    string eid        = txtbxEID.Text;
                    string workingDay = ddlworkingType.Text;

                    var getdata = objAtt_BLL.GetAllOfficeDayById(OCODE, eid, Convert.ToDateTime(txtDate.Text));

                    var getAttendancedata = objAtt_BLL.GetAttendanceByEID_Date(OCODE, eid, Convert.ToDateTime(txtDate.Text));

                    if (getdata.Count() == 0)   //insert
                    {
                        aHRM_OfficialDay_Individual.EID           = txtbxEID.Text;
                        aHRM_OfficialDay_Individual.Official_Date = Convert.ToDateTime(txtDate.Text);
                        aHRM_OfficialDay_Individual.Working_Day   = workingDay;
                        aHRM_OfficialDay_Individual.OCode         = OCODE;
                        aHRM_OfficialDay_Individual.Edit_Date     = EDIT_DATE;
                        aHRM_OfficialDay_Individual.Edit_User     = userId;

                        lstHRM_OfficialDay_Individual.Add(aHRM_OfficialDay_Individual);

                        _context.HRM_OfficialDay_Individual.AddObject(aHRM_OfficialDay_Individual);

                        _context.SaveChanges();  // insert working day type

                        if (getAttendancedata.Count > 0)
                        {
                            HRM_ATTENDANCE aHRM_ATTENDANCE = new HRM_ATTENDANCE();

                            DateTime date = Convert.ToDateTime(Attdate);
                            aHRM_ATTENDANCE = _context.HRM_ATTENDANCE.Where(c => c.EID == eid && c.Attendance_Date == date).First();

                            aHRM_ATTENDANCE.Update_Status = 0;
                            aHRM_ATTENDANCE.OCode         = OCODE;
                            aHRM_ATTENDANCE.Edit_Date     = EDIT_DATE;
                            aHRM_ATTENDANCE.Edit_User     = userId;

                            _context.SaveChanges();   // update attendance update status

                            // update attendnace status by date
                            aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                            //insert/update leave/holiday attendnace status process by selected eid
                            aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID2(lstHRM_OfficialDay_Individual, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                            //ot process

                            List <string> ShiftCodes = objAtt_BLL.GetAllShiftCode(OCODE).ToList();

                            foreach (string ashiftcode in ShiftCodes)
                            {
                                objAtt_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text), ashiftcode);
                            }

                            //ot process log
                            var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtDate.Text));
                            var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtDate.Text));
                            var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                            var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                            var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                            string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                            _context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);
                        }

                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);

                        grdview.DataSource = null;
                        grdview.DataBind();
                    }

                    else  //update
                    {
                        HRM_OfficialDay_Individual _HRM_OfficialDay_Individual = new HRM_OfficialDay_Individual();

                        _HRM_OfficialDay_Individual = _context.HRM_OfficialDay_Individual.Where(c => c.EID == eid).First();

                        _HRM_OfficialDay_Individual.Working_Day   = workingDay;
                        _HRM_OfficialDay_Individual.OCode         = OCODE;
                        _HRM_OfficialDay_Individual.Edit_Date     = EDIT_DATE;
                        _HRM_OfficialDay_Individual.Edit_User     = userId;
                        _HRM_OfficialDay_Individual.Official_Date = Convert.ToDateTime(txtDate.Text);

                        lstHRM_OfficialDay_Individual.Add(_HRM_OfficialDay_Individual);

                        int result = objAtt_BLL.UpdateWorkingDay(lstHRM_OfficialDay_Individual); // update working day type

                        if (result == 1)
                        {
                            if (getAttendancedata.Count > 0)
                            {
                                HRM_ATTENDANCE aHRM_ATTENDANCE = new HRM_ATTENDANCE();
                                DateTime       date            = Convert.ToDateTime(Attdate);
                                aHRM_ATTENDANCE = _context.HRM_ATTENDANCE.Where(c => c.EID == eid && c.Attendance_Date == date).First();

                                aHRM_ATTENDANCE.Update_Status = 0;
                                aHRM_ATTENDANCE.OCode         = OCODE;
                                aHRM_ATTENDANCE.Edit_Date     = EDIT_DATE;
                                aHRM_ATTENDANCE.Edit_User     = userId;

                                _context.SaveChanges();   // update attendnace update status

                                // update attendnace status by date
                                aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                //insert/update leave/holiday attendnace status process by selected eid
                                aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID2(lstHRM_OfficialDay_Individual, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                //ot process

                                List <string> ShiftCodes = objAtt_BLL.GetAllShiftCode(OCODE).ToList();

                                foreach (string ashiftcode in ShiftCodes)
                                {
                                    objAtt_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text), ashiftcode);
                                }

                                //ot process log
                                var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtDate.Text));
                                var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtDate.Text));
                                var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                                var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                _context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);
                            }
                            grdview.DataSource = null;
                            grdview.DataBind();
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processing Faliure!')", true);
                        }
                    }
                    ClearUI();
                }

                else  // dept/section/subsection wise working day type change
                {
                    if (grdview.Rows.Count < 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                        return;
                    }

                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                        HRM_OfficialDay_Individual aHRM_OfficialDay_Individual = new HRM_OfficialDay_Individual();

                        Label  lblEID = ((Label)gvRow.FindControl("lblEID"));
                        string eid    = lblEID.Text.ToString();

                        DropDownList ddlworking_Day = ((DropDownList)gvRow.FindControl("ddlworking_Day"));
                        string       workingDay     = ddlworking_Day.Text;

                        var getdata = objAtt_BLL.GetAllOfficeDayById(OCODE, eid, Convert.ToDateTime(txtDate.Text));

                        //var getAttendancedata = objAtt_BLL.GetAttendanceByEID_Date(OCODE, eid, Convert.ToDateTime(txtDate.Text));

                        if (rowChkBox.Checked == true)
                        {
                            if (getdata.Count() == 0) //insert
                            {
                                aHRM_OfficialDay_Individual.EID           = lblEID.Text;
                                aHRM_OfficialDay_Individual.Official_Date = Convert.ToDateTime(txtDate.Text);
                                aHRM_OfficialDay_Individual.Working_Day   = workingDay;
                                aHRM_OfficialDay_Individual.OCode         = OCODE;
                                aHRM_OfficialDay_Individual.Edit_Date     = EDIT_DATE;
                                aHRM_OfficialDay_Individual.Edit_User     = userId;

                                lstHRM_OfficialDay_Individual.Add(aHRM_OfficialDay_Individual);

                                _context.HRM_OfficialDay_Individual.AddObject(aHRM_OfficialDay_Individual);

                                _context.SaveChanges(); //insert

                                //if (getAttendancedata.Count > 0)
                                //{
                                //foreach (var aHRM_ATTENDANCE in _context.HRM_ATTENDANCE.Where(x => x.EID == eid && x.Attendance_Date == workingDate))
                                //{
                                //    aHRM_ATTENDANCE.Update_Status = 0;
                                //    aHRM_ATTENDANCE.OCode = OCODE;
                                //    aHRM_ATTENDANCE.Edit_Date = EDIT_DATE;
                                //    aHRM_ATTENDANCE.Edit_User = userId;
                                //}
                                //_context.CommandTimeout = 1000;
                                //_context.SaveChanges();


                                //HRM_ATTENDANCE aHRM_ATTENDANCE = new HRM_ATTENDANCE();
                                //DateTime date = Convert.ToDateTime(Attdate);
                                //aHRM_ATTENDANCE = _context.HRM_ATTENDANCE.Where(c => c.EID == eid && c.Attendance_Date == date).First();

                                //aHRM_ATTENDANCE.Update_Status = 0;
                                //aHRM_ATTENDANCE.OCode = OCODE;
                                //aHRM_ATTENDANCE.Edit_Date = EDIT_DATE;
                                //aHRM_ATTENDANCE.Edit_User = userId;

                                //_context.SaveChanges();

                                //aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text)); // update attendnace status by date

                                //insert/update leave/holiday attendnace status process by selected eid
                                //aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID2(lstHRM_OfficialDay_Individual, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                //ot process

                                //List<string> ShiftCodes = objAtt_BLL.GetAllShiftCode(OCODE).ToList();

                                //foreach (string ashiftcode in ShiftCodes)
                                //{
                                //    objAtt_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text), ashiftcode);
                                //}

                                ////ot process log
                                //var ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtDate.Text));
                                //var ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtDate.Text));
                                //var ParamempID3 = new SqlParameter("@Edit_User", userId);
                                //var ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                //var ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                //string SP_SQL = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                //_context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);
                                //}

                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);

                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                            else  //update
                            {
                                foreach (var _HRM_OfficialDay_Individual in _context.HRM_OfficialDay_Individual.Where(x => x.EID == eid && x.Official_Date == workingDate))
                                {
                                    _HRM_OfficialDay_Individual.Working_Day = workingDay;
                                    _HRM_OfficialDay_Individual.OCode       = OCODE;
                                    _HRM_OfficialDay_Individual.Edit_Date   = EDIT_DATE;
                                    _HRM_OfficialDay_Individual.Edit_User   = userId;

                                    lstHRM_OfficialDay_Individual.Add(_HRM_OfficialDay_Individual);
                                }

                                _context.SaveChanges();

                                //if (getAttendancedata.Count > 0)
                                //{
                                //foreach (var aHRM_ATTENDANCE in _context.HRM_ATTENDANCE.Where(x => x.EID == eid && x.Attendance_Date == workingDate))
                                //{
                                //    aHRM_ATTENDANCE.Update_Status = 0;
                                //    aHRM_ATTENDANCE.OCode = OCODE;
                                //    aHRM_ATTENDANCE.Edit_Date = EDIT_DATE;
                                //    aHRM_ATTENDANCE.Edit_User = userId;
                                //}
                                // _context.CommandTimeout = 1000;
                                //_context.SaveChanges();

                                //HRM_ATTENDANCE aHRM_ATTENDANCE = new HRM_ATTENDANCE();
                                //DateTime date = Convert.ToDateTime(Attdate);
                                //aHRM_ATTENDANCE = _context.HRM_ATTENDANCE.Where(c => c.EID == eid && c.Attendance_Date == date).First();

                                //aHRM_ATTENDANCE.Update_Status = 0;
                                //aHRM_ATTENDANCE.OCode = OCODE;
                                //aHRM_ATTENDANCE.Edit_Date = EDIT_DATE;
                                //aHRM_ATTENDANCE.Edit_User = userId;

                                //_context.SaveChanges();

                                // update attendnace status by date
                                //aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                //insert/update leave/holiday attendnace status process by selected eid
                                //aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID2(lstHRM_OfficialDay_Individual, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                //ot process

                                //List<string> ShiftCodes = objAtt_BLL.GetAllShiftCode(OCODE).ToList();

                                //foreach (string ashiftcode in ShiftCodes)
                                //{
                                //    objAtt_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text), ashiftcode);
                                //}

                                ////ot process log
                                //var ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtDate.Text));
                                //var ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtDate.Text));
                                //var ParamempID3 = new SqlParameter("@Edit_User", userId);
                                //var ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                //var ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                //string SP_SQL = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                //_context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);
                                //}

                                grdview.DataSource = null;
                                grdview.DataBind();
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                            }
                        }
                    }
                    //_context.SaveChanges();
                    ClearUI();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 53
0
        private FlowLayoutWidget CreateSelectionContainer(string labelText, string validationMessage, DropDownList selector)
        {
            var sectionLabel = new TextWidget(labelText, 0, 0, 12)
            {
                TextColor = theme.TextColor,
                HAnchor   = HAnchor.Stretch,
                Margin    = elementMargin
            };

            var validationTextWidget = new TextWidget(validationMessage, 0, 0, 10)
            {
                TextColor = theme.PrimaryAccentColor,
                HAnchor   = HAnchor.Stretch,
                Margin    = elementMargin
            };

            selector.SelectionChanged += (s, e) =>
            {
                validationTextWidget.Visible = selector.SelectedLabel.StartsWith("-");                 // The default values have "- Title -"
            };

            var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                Margin  = new BorderDouble(0, 5),
                HAnchor = HAnchor.Stretch
            };

            container.AddChild(sectionLabel);
            container.AddChild(selector);
            container.AddChild(validationTextWidget);

            return(container);
        }
Ejemplo n.º 54
0
        protected void ddlOrdenZonasPais_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList objeto = sender as DropDownList;

            CargaZonasHorarias(Orden: objeto.SelectedItem.Value);
        }
Ejemplo n.º 55
0
 /// <summary>
 /// Decorates the givenn .net drop down list with the specified behaivour.
 /// </summary>
 /// <param name="ddl"></param>
 public ClienteDropDownListWrapper(DropDownList ddl) : base(ddl)
 {
     AddNoneItem = false;
 }
Ejemplo n.º 56
0
        public static void BindToDropDownList(DropDownList ddlID, string selectValue)
        {
            Model.SelectRecord selectRecord = new Model.SelectRecord
            {
                Irecord = "",
                Scolumnlist = "ID,Name",
                Stablename = "Organizational",
                Scondition = "where PID='0'"
            };
            DataTable table = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0];
            if ((table != null) && (table.Rows.Count != 0))
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    ListItem item6 = new ListItem
                    {
                        Value = table.Rows[i]["ID"].ToString(),
                        Text = table.Rows[i]["Name"].ToString()
                    };
                    ListItem item = item6;
                    ddlID.Items.Add(item);
                    selectRecord.Scondition = "where PID='" + item.Value + "'";
                    DataTable table2 = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0];
                    if ((table2 != null) && (table2.Rows.Count != 0))
                    {
                        for (int j = 0; j < table2.Rows.Count; j++)
                        {
                            ListItem item5 = new ListItem
                            {
                                Value = table2.Rows[j]["ID"].ToString(),
                                Text = "  " + table2.Rows[j]["Name"].ToString()
                            };
                            ListItem item2 = item5;
                            ddlID.Items.Add(item2);
                            selectRecord.Scondition = "where PID='" + item2.Value + "'";
                            DataTable table3 = BLL.SelectRecord.SelectRecordData(selectRecord).Tables[0];
                            if ((table3 != null) && (table3.Rows.Count != 0))
                            {
                                for (int k = 0; k < table3.Rows.Count; k++)
                                {
                                    ListItem item4 = new ListItem
                                    {
                                        Value = table3.Rows[k]["ID"].ToString(),
                                        Text = "    " + table3.Rows[k]["Name"].ToString()
                                    };
                                    ListItem item3 = item4;
                                    ddlID.Items.Add(item3);
                                }
                                table3.Clear();
                                table3.Dispose();
                            }
                        }
                        table2.Clear();
                        table2.Dispose();
                    }
                }
                table.Clear();
                table.Dispose();
            }

            ListItem item8 = new ListItem
            {
                Text = "请选择岗位信息",
                Value = "0"
            };
            ddlID.Items.Add(item8);

            ddlID.DataBind();
            ddlID.Items.FindByValue(selectValue).Selected = true;
        }