예제 #1
0
        private Boolean StaffFormBind()
        {
            string qryString = "Select staff_id,sLoginID,sLoginPW,position,staffNbr,sName,DeptName,sClass,subJobs,phone,cellularP,ExtNbr,sEmail,SSN,zipcode,address"
                               + ",homepage,mark,sLevel,sBusinessPic,sAvataImage,sData,joinDT"
                               + " FROM t_Staff"
                               + " WHERE staff_id=" + _sfID;

            qryString += ";Select annGroup,itemFlag,annDate FROM t_Anniversary WHERE annGroup<100 AND item_id=" + _sfID;

            SqlDataReader drStaff;

            DBLib dbUtil = new DBLib();

            drStaff = dbUtil.MyExecuteReader(qryString);
            if (drStaff.Read())
            {
                string[] arrTemp;
                //this.staff_id.Text = sfID;
                this.sLoginID.Text          = drStaff["sLoginID"].ToString();
                this.sLoginPW.Text          = drStaff["sLoginPW"].ToString();
                position.Text               = PtnBaseLib.Self.GetPartnerCompany(Convert.ToInt16(Cookie.Self["position"]));
                this.staffNbr.Text          = drStaff["staffNbr"].ToString();
                this.sName.Text             = drStaff["sName"].ToString();
                this.DeptName.SelectedValue = drStaff["DeptName"].ToString();
                this.sClass.SelectedValue   = TableConfig.GetKey("Class_root", drStaff["sClass"].ToString());
                this.subJobs.Text           = drStaff["subJobs"].ToString();

                arrTemp = drStaff["phone"].ToString().Split('-');
                if (arrTemp.Length > 0)
                {
                    this.phone1.Text = arrTemp[0];
                    this.phone2.Text = arrTemp[1];
                    this.phone3.Text = arrTemp[2];
                    arrTemp          = null;
                }
                arrTemp = drStaff["cellularP"].ToString().Split('-');
                if (arrTemp.Length > 0)
                {
                    this.cellularP1.Text = arrTemp[0];
                    this.cellularP2.Text = arrTemp[1];
                    this.cellularP3.Text = arrTemp[2];
                    arrTemp = null;
                }
                this.ExtNbr.Text = drStaff["ExtNbr"].ToString();
                this.sEmail.Text = drStaff["sEmail"].ToString();
                arrTemp          = drStaff["SSN"].ToString().Split('-');
                if (arrTemp.Length > 0)
                {
                    this.SSN1.Text = arrTemp[0];
                    this.SSN2.Text = arrTemp[1];
                    arrTemp        = null;
                }
                this.zipcode.Text = drStaff["zipcode"].ToString();
                arrTemp           = drStaff["address"].ToString().Split('|');
                if (arrTemp.Length > 1)
                {
                    this.address1.Text = arrTemp[0];
                    this.address2.Text = arrTemp[1];
                    arrTemp            = null;
                }

                this.homepage.Text = drStaff["homepage"].ToString();
                this.mark.Text     = drStaff["mark"].ToString();
                this.sLevel.Text   = drStaff["sLevel"].ToString();
                //뷰스테이트로 파일 경로 저장 (체크박스 툴팁이용)
                //PostState.Self["sBusinessPic"] = drStaff["sBusinessPic"].ToString();
                //PostState.Self["sAvataImage"] = drStaff["sAvataImage"].ToString();
                //PostState.Self["sData"] = drStaff["sData"].ToString();
                this.sBusinessPic.ImageUrl              = SystemConfig.GetValue("StaffUploadDir") + Text.SetDefaultValue(drStaff["sBusinessPic"].ToString(), "MyPic_default.gif");
                this.sBusinessPic.Style["cursor"]       = "hand";
                this.sBusinessPic.Attributes["OnClick"] = "javascript:ZoomWindowOpen('" + this.sBusinessPic.ImageUrl + "','bizPic','');";
                //이미지 리사이즈
                JinsLibrary.IMAGE.ImageLib.Self.ImageResize(ref sBusinessPic, 150, 200);

                this.sAvataImage.ImageUrl = @"../../zUpload/stfData/" + Text.SetDefaultValue(drStaff["sAvataImage"].ToString(), "MyPic_default.gif");
                this.joinDT.Text          = drStaff["joinDT"].ToString();

                //파일 보존 체크박스처리
                if (drStaff["sBusinessPic"].ToString() != "")
                {
                    cbKeepBP.Visible = true;
                    cbKeepBP.Checked = true;
                    cbKeepBP.ToolTip = drStaff["sBusinessPic"].ToString();
                }
                if (drStaff["sAvataImage"].ToString() != "")
                {
                    cbKeepAI.Visible = true;
                    cbKeepAI.Checked = true;
                    cbKeepAI.ToolTip = drStaff["sAvataImage"].ToString();
                }
                if (drStaff["sData"].ToString() != "")
                {
                    cbKeepData.Visible = true;
                    cbKeepData.Checked = true;
                    cbKeepData.ToolTip = drStaff["sData"].ToString();
                }

                //기념일 셋팅
                if (drStaff.NextResult())
                {
                    string annDate;
                    while (drStaff.Read())
                    {
                        if (drStaff["annDate"].ToString() != "")
                        {
                            annDate = Convert.ToDateTime(drStaff["annDate"]).ToShortDateString();
                        }
                        else
                        {
                            annDate = "";
                        }
                        //Response.Write("----> " + drStaff["annDate"].ToString());

                        switch (Convert.ToInt32(drStaff["annGroup"]))
                        {
                        case 10:                            //생일
                            Util.RBLFindByValue(ref rblSLBirth, drStaff["itemFlag"].ToString());
                            this.tbBirthDay.Text = annDate; //Convert.ToDateTime(drStaff["annDate"]).ToShortDateString();
                            break;

                        case 20:                //결혼기념일
                            Util.RBLFindByValue(ref rblMarried, drStaff["itemFlag"].ToString());
                            //this.rblMarried.SelectedValue = drStaff["itemFlag"].ToString(); //되냉
                            if (rblMarried.SelectedValue == "미")
                            {
                                ClientAction.WriteJavascript(this, "pnWA", "pnWA.style.display='none';");
                            }
                            else
                            if (drStaff["annDate"].ToString() != "")
                            {
                                this.tbWeddingDay.Text = annDate;        //Convert.ToDateTime(drCard["annDate"]).ToShortDateString();
                            }
                            break;
                        }
                    }
                }

                //기획/관리부가 아닐때 수정못하게...
                if (Convert.ToInt16(Cookie.Self["sLevel"]) < 30)
                {
                    this.staffNbr.Enabled         = false;
                    this.sClass.Enabled           = false;
                    this.DeptName.Enabled         = false;
                    this.joinDT.Enabled           = false;
                    this.dSelectorJoinDay.Visible = false;
                }
                drStaff.Close();
                //DB닫기
                dbUtil.SqlConnection.Close();
                return(true);
            }
            else
            {
                return(false);
            }
        }