Пример #1
0
 public static Double DT_HourMinConvertToHour(int tam)
 {
     if (tam == 0)
     {
         return(0);
     }
     //return T_String.IsNullTo00((tam/100)+"."+(((double)tam-((tam/100)*100))/60));
     return(T_String.IsNullTo00((tam / 100) + (((double)tam - ((tam / 100) * 100)) / 60) + ""));
 }
Пример #2
0
        public static int DT_GetDays(DateTime dt1, DateTime dt2)
        {
            int      tam = 0;
            DateTime d1  = dt1;
            DateTime d2  = dt2;

            while (T_String.IsNullTo0(d1.ToString("yyyyMMdd")) <= T_String.IsNullTo0(d2.ToString("yyyyMMdd")))
            {
                tam++;
                d1 = d1.AddDays(1);
            }
            return(tam);
        }
Пример #3
0
        public static int DT_GetDays(DateTime dt1, DateTime dt2, string EMP_ID)
        {
            int      tam = 0;
            DateTime d1  = dt1;
            DateTime d2  = dt2;

            while (T_String.IsNullTo0(d1.ToString("yyyyMMdd")) <= T_String.IsNullTo0(d2.ToString("yyyyMMdd")))
            {
                string sql = "EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + d1.ToString("yyyyMM") + "'";
                if (GetDataFromSQL("DAY_" + d1.ToString("dd"), "FILC03A", sql) != "00" && d1.DayOfWeek != DayOfWeek.Sunday)
                {
                    tam++;
                }
                d1 = d1.AddDays(1);
            }
            return(tam);
        }
Пример #4
0
 public static Double GetMax0(string FieldName, string from, string where)
 {
     return(T_String.IsNullTo00(GetDataFromSQL(FieldName, from, where)) + 1);
 }
Пример #5
0
 public static int  GetMax(string FieldName, string from)
 {
     return(T_String.IsNullTo0(GetDataFromSQL(FieldName, from)) + 1);
 }
Пример #6
0
 public static Boolean CompareDate(DateTime dt1, DateTime dt2)
 {
     return(T_String.IsNullTo0(dt1.ToString("yyyyMMdd")) >= T_String.IsNullTo0(dt2.ToString("yyyyMMdd")));
 }
Пример #7
0
        public static void D_GetDataFromVS(System.Windows.Forms.GroupBox fr, C1.Win.C1FlexGrid.C1FlexGrid vs)
        {
            int i = 0;

            if (vs.Row <= 0)
            {
                try
                {
                    for (i = 0; i < fr.Controls.Count; i++)
                    {
                        switch (fr.Controls[i].GetType().FullName)
                        {
                        case "C1.Win.C1Input.C1TextBox":
                            C1.Win.C1Input.C1TextBox c1txt = (C1.Win.C1Input.C1TextBox)fr.Controls[i];
                            if ((c1txt.Tag + "") != "")
                            {
                                c1txt.Value = null;
                            }
                            break;

                        case "System.Windows.Forms.TextBox":
                            if ((((System.Windows.Forms.TextBox)fr.Controls[i]).Tag + "") != "")
                            {
                                ((System.Windows.Forms.TextBox)fr.Controls[i]).Text = null;
                            }
                            break;

                        case "System.Windows.Forms.DateTimePicker":
                            System.Windows.Forms.DateTimePicker dt = (System.Windows.Forms.DateTimePicker)fr.Controls[i];
                            if (dt.Tag + "" != "")
                            {
                                dt.Text = null;
                            }
                            break;

                        case "C1.Win.C1Input.C1DateEdit":
                            C1.Win.C1Input.C1DateEdit dt1 = (C1.Win.C1Input.C1DateEdit)fr.Controls[i];
                            if (dt1.Tag + "" != "")
                            {
                                dt1.Value = null;
                            }
                            break;

                        case "System.Windows.Forms.CheckBox":
                            CheckBox chbox = (System.Windows.Forms.CheckBox)fr.Controls[i];
                            if ((chbox.Tag + "") != "")
                            {
                                chbox.Checked = false;
                            }
                            break;

                        case "System.Windows.Forms.ComboBox":
                            ComboBox cbbox = (System.Windows.Forms.ComboBox)fr.Controls[i];
                            if ((cbbox.Tag + "") != "")
                            {
                                cbbox.SelectedValue = "";
                            }
                            break;
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Get data from VS error" + fr.Controls[i].Tag);
                }
                return;
            }
            else
            {
                string st = "";
                try
                {
                    for (i = 0; i < fr.Controls.Count; i++)
                    {
                        switch (fr.Controls[i].GetType().FullName)
                        {
                        case "C1.Win.C1Input.C1TextBox":
                            C1.Win.C1Input.C1TextBox c1txt = (C1.Win.C1Input.C1TextBox)fr.Controls[i];
                            st = "";
                            if ((c1txt.Tag + "") != "")
                            {
                                st = D_GetDataFromVS1(vs, c1txt.Tag + "");
                            }
                            if (st == "")
                            {
                                st = null;
                            }
                            c1txt.Value = st;
                            break;

                        case "System.Windows.Forms.TextBox":
                            if ((((System.Windows.Forms.TextBox)fr.Controls[i]).Tag + "") != "")
                            {
                                ((System.Windows.Forms.TextBox)fr.Controls[i]).Text = D_GetDataFromVS1(vs, ((System.Windows.Forms.TextBox)fr.Controls[i]).Tag + "");
                            }
                            break;

                        case "System.Windows.Forms.DateTimePicker":
                            System.Windows.Forms.DateTimePicker dt = (System.Windows.Forms.DateTimePicker)fr.Controls[i];
                            if (dt.Tag + "" != "")
                            {
                                st = "";
                                st = D_GetDataFromVS1(vs, dt.Tag + "");
                                if (st == "" || st == null)
                                {
                                    dt.Text = null;
                                }
                                else
                                {
                                    dt.Text = st;
                                }
                            }
                            break;

                        case "C1.Win.C1Input.C1DateEdit":
                            C1.Win.C1Input.C1DateEdit dt1 = (C1.Win.C1Input.C1DateEdit)fr.Controls[i];
                            if (dt1.Tag + "" != "")
                            {
                                st = "";
                                st = D_GetDataFromVS1(vs, dt1.Tag + "");
                                if (st == "" || st == null)
                                {
                                    dt1.Value = null;
                                }
                                else
                                {
                                    dt1.Value = DateTime.Parse(st).ToString("yyyy/MM/dd");
                                }
                            }
                            break;

                        case "System.Windows.Forms.CheckBox":
                            CheckBox chbox = (System.Windows.Forms.CheckBox)fr.Controls[i];
                            if ((chbox.Tag + "") != "")
                            {
                                chbox.Checked = ConvertStringToBoolean(D_GetDataFromVS1(vs, chbox.Tag + ""));
                            }
                            break;

                        case "System.Windows.Forms.ComboBox":
                            ComboBox cbbox = (System.Windows.Forms.ComboBox)fr.Controls[i];
                            if ((cbbox.Tag + "") != "")
                            {
                                cbbox.SelectedValue = "";
                                string st1 = D_GetDataFromVS1(vs, cbbox.Tag + "");
                                if (st1 == "")
                                {
                                    cbbox.SelectedValue = "";
                                }
                                else
                                {
                                    cbbox.SelectedValue = st1;
                                }
                            }
                            break;
                        }
                    }
                    TextBoxAndVS.D_AddNewOrEdit(fr, (T_String.IsNullTo0(vs.Rows[vs.Row].UserData + "") != 2));
                }
                catch (Exception)
                {
                    MessageBox.Show("Get data from VS error" + fr.Controls[i].Tag);
                }
            }
        }
Пример #8
0
        public static void D_GetDataFromTextBox(System.Windows.Forms.GroupBox fr, C1.Win.C1FlexGrid.C1FlexGrid vs)
        {
            if (vs.Row <= 0)
            {
                return;
            }
            try
            {
                for (int i = 0; i < fr.Controls.Count; i++)
                {
                    switch (fr.Controls[i].GetType().FullName)
                    {
                    case "C1.Win.C1Input.C1DateEdit":
                        C1.Win.C1Input.C1DateEdit dt1 = (C1.Win.C1Input.C1DateEdit)fr.Controls[i];
                        if (dt1.Tag + "" != "")
                        {
                            if (dt1.Value + "" == "")
                            {
                                vs.SetData(vs.Row, dt1.Tag + "", null);
                            }
                            else
                            {
//								if (dt1.CustomFormat!="" || dt1.CustomFormat!=null)
//									vs.SetData(vs.Row,dt1.Tag+"",Set_vs(DateTime.Parse(dt1.Value+"").ToString(dt1.CustomFormat)));
//								else
                                vs.SetData(vs.Row, dt1.Tag + "", Set_vs(dt1.Value));
                            }
                        }
                        break;

                    case "C1.Win.C1Input.C1TextBox":
                        C1.Win.C1Input.C1TextBox c1txt = (C1.Win.C1Input.C1TextBox)fr.Controls[i];
                        if ((c1txt.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, c1txt.Tag + "", Set_vs(c1txt.Value));
                        }
                        break;

                    case "System.Windows.Forms.TextBox":
                        TextBox txt = (System.Windows.Forms.TextBox)fr.Controls[i];
                        if ((txt.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, txt.Tag + "", Set_vs(txt.Text));
                        }
                        break;

                    case "System.Windows.Forms.CheckBox":
                        CheckBox chbox = (System.Windows.Forms.CheckBox)fr.Controls[i];
                        if ((chbox.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, chbox.Tag + "", Set_vs(chbox.Checked));
                        }
                        break;

                    case "System.Windows.Forms.ComboBox":
                        ComboBox cbbox = (System.Windows.Forms.ComboBox)fr.Controls[i];
                        if ((cbbox.Tag + "") != "")
                        {
                            vs.SetData(vs.Row, cbbox.Tag + "", Set_vs(cbbox.SelectedValue));
                        }
                        break;
                    }
                }
                TextBoxAndVS.D_AddNewOrEdit(fr, (T_String.IsNullTo0(vs.Rows[vs.Row].UserData + "") != 2));
            }
            catch (Exception)
            {
                MessageBox.Show("Get data from VS error");
            }
        }