protected void rpParams_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         MachLookUp  item         = e.Item.DataItem as MachLookUp;
         int         machLookupId = item.Mach_Id;
         CheckBox    cbParam      = e.Item.FindControl("cbParam") as CheckBox;
         HiddenField hdId         = e.Item.FindControl("hdId") as HiddenField;
         if (string.Equals(Type, "l", StringComparison.OrdinalIgnoreCase))
         {
             if (LongMachList.Contains(machLookupId.ToString()))
             {
                 cbParam.Checked = true;
             }
         }
         else if (string.Equals(Type, "w", StringComparison.OrdinalIgnoreCase))
         {
             if (WidthMachList.Contains(machLookupId.ToString()))
             {
                 cbParam.Checked = true;
             }
         }
         else if (string.Equals(Type, "d", StringComparison.OrdinalIgnoreCase))
         {
             if (DeepthMachList.Contains(machLookupId.ToString()))
             {
                 cbParam.Checked = true;
             }
         }
     }
 }
Beispiel #2
0
 protected void rpDisplay_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         MachLookUp item    = e.Item.DataItem as MachLookUp;
         Image      imgMach = e.Item.FindControl("imgMach") as Image;
         imgMach.ImageUrl = Page.ResolveUrl(string.Format("~/_Files/MachTypeImage/{0}", item.MachIdentity));
         string machType    = item.Name;
         Label  lblMachType = e.Item.FindControl("lblMachType") as Label;
         lblMachType.Text = machType;
     }
 }
        protected void rpMachiningInstall_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            MachLookupDAL dal = new MachLookupDAL();

            if (e.CommandName == "Add")
            {
                var txtCodeAdd         = e.Item.FindControl("txtCodeAdd") as TextBox;
                var txtNameAdd         = e.Item.FindControl("txtNameAdd") as TextBox;
                var txtPriceMAdd       = e.Item.FindControl("txtPriceMAdd") as TextBox;
                var txtPriceM2Add      = e.Item.FindControl("txtPriceM2Add") as TextBox;
                var txtPriceOtherAdd   = e.Item.FindControl("txtPriceOtherAdd") as TextBox;
                var txtMachIdentityAdd = e.Item.FindControl("txtMachIdentityAdd") as TextBox;
                var txtRemarkAdd       = e.Item.FindControl("txtRemarkAdd") as TextBox;

                var machLookup = new MachLookUp();
                machLookup.Code            = txtCodeAdd.Text;
                machLookup.IdentityImgPath = string.Empty;
                machLookup.Intro           = txtRemarkAdd.Text;
                machLookup.IsActive        = true;
                machLookup.MachIdentity    = txtMachIdentityAdd.Text;
                machLookup.Name            = txtNameAdd.Text;
                machLookup.PriceM          = double.Parse(txtPriceMAdd.Text);
                machLookup.PriceM2         = double.Parse(txtPriceM2Add.Text);
                machLookup.PriceOther      = double.Parse(txtPriceOtherAdd.Text);

                dal.AddMachLookup(machLookup);
                dal.Save();
            }
            else if (e.CommandName == "Save")
            {
                var hdId       = e.Item.FindControl("hdId") as HiddenField;
                var machLookup = dal.GetMachLookupById(int.Parse(hdId.Value));
                machLookup.PriceM       = double.Parse((e.Item.FindControl("txtPriceM") as TextBox).Text);
                machLookup.PriceM2      = double.Parse((e.Item.FindControl("txtPriceM2") as TextBox).Text);
                machLookup.PriceOther   = double.Parse((e.Item.FindControl("txtPriceOther") as TextBox).Text);
                machLookup.MachIdentity = (e.Item.FindControl("txtMachIdentity") as TextBox).Text;
                machLookup.Intro        = (e.Item.FindControl("txtRemark") as TextBox).Text;
                dal.Save();
            }
            else if (e.CommandName == "Delete")
            {
                var hdId = e.Item.FindControl("hdId") as HiddenField;
                dal.DeleteMachLookup(int.Parse(hdId.Value));
            }
            BindControl();
        }
Beispiel #4
0
 public void AddMachLookup(MachLookUp mach)
 {
     mach.IsActive = true;
     Db.MachLookUp.AddObject(mach);
 }